diff --git a/gatsby-node.ts b/gatsby-node.ts index 0643119..338e8dc 100644 --- a/gatsby-node.ts +++ b/gatsby-node.ts @@ -10,8 +10,10 @@ import { } from './src/common/constants'; import { type AbsolutePathString, + type EmptyObject, EntryPage, type IndexPageContext, + type PageMetadata, type ProjectPageContext, type ResumePageContext, } from './src/common/types'; @@ -133,7 +135,10 @@ function sortByCreatedAt(a: Queries.GithubRepo, b: Queries.GithubRepo) { // Create the resume page function createResumePage(githubRepos: Queries.GithubRepo[]) { + const path = '/resume'; + const pageMetadata: PageMetadata | EmptyObject = getPageMetadata(path) || {}; const context: ResumePageContext = { + pageMetadata, githubRepos: getSubsetOfGithubRepos( githubRepos, EntryPage.Resume, @@ -142,9 +147,9 @@ function createResumePage(githubRepos: Queries.GithubRepo[]) { }; createPage({ - path: '/resume', + path: path, component: RESUME_PAGE_TEMPLATE, - socialImageComponent: INDEX_OG_IMAGE_TEMPLATE, + socialImageComponent: OTHER_OG_IMAGE_TEMPLATE, context: context, }); } @@ -256,7 +261,6 @@ export const createPages: GatsbyNode['createPages'] = async ({ graphql }) => { // TODO: Re-enable this when project pages are implemented // createProjectPages(githubRepos); createIndexPage(githubRepos, authorBioHtml); - // TODO: Re-enable this when the resume page is implemented createResumePage(githubRepos); createRedirects(); }; diff --git a/src/common/types.ts b/src/common/types.ts index eb3f168..d659ab7 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -355,18 +355,34 @@ export type GithubRepo = { // export type GithubRepo = Queries.GithubReposQuery; -// Page context for the index page +// Page context to add to the index page export type IndexPageContext = { githubRepos: Queries.GithubRepo[]; authorBioHtml: string; }; -// Page context for project pages +// Page context to add to project pages export type ProjectPageContext = { githubRepo: Queries.GithubRepo; }; -// Page context for the resume page -export type ResumePageContext = { +// Page context to add to the resume page +export type ResumePageContext = PageMetadataProp & { githubRepos: Queries.GithubRepo[]; }; + +// Page context for the privacy policy page +export type PrivacyPageContext = PageMetadataProp; + +// Page context for the 404 page +export type NotFoundPageContext = PageMetadataProp; + +// Page context for the index social image page +export type IndexSocialImagePageContext = IndexPageContext & ImageMetadataProp; + +// Page context for other social image pages +export type OtherSocialImagePageContext = PageMetadataProp & ImageMetadataProp; + +// Page context for project social image pages +export type ProjectSocialImagePageContext = ProjectPageContext & + ImageMetadataProp; diff --git a/src/common/utils.ts b/src/common/utils.ts index 828cab5..9e8ca47 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -5,7 +5,7 @@ import { panic } from '../node/logger'; import { getSiteMetadata } from './config-manager'; -import type { PropsWithClassName, SentenceString } from './types'; +import type { PropsWithClassName, SentenceString, UrlString } from './types'; // Constants @@ -195,8 +195,10 @@ export function removeTrailingSlash(path: string) { } // Remove the protocol from a URL -export function removeProtocol(url: string) { - return url.replace(/.*?:\/\//g, ''); +export function removeProtocol(url: UrlString | URL) { + const urlString = url instanceof URL ? url.toString() : url; + + return urlString.replace(/.*?:\/\//g, ''); } // Return the first n elements of an array diff --git a/src/components/layout/resume-header.tsx b/src/components/layout/resume-header.tsx index ab19ffd..e29c826 100644 --- a/src/components/layout/resume-header.tsx +++ b/src/components/layout/resume-header.tsx @@ -11,7 +11,7 @@ import { } from '@fortawesome/free-solid-svg-icons'; import { getSiteMetadata } from '../../common/config-manager'; import { type CityAndStateString, TooltipPosition } from '../../common/types'; -import { removeProtocol } from '../../common/utils'; +import { getAbsoluteUrl, removeProtocol } from '../../common/utils'; import { GhostButton } from '../input/ghost-button'; import { GhostButtonLink } from '../links/ghost-button-link'; import { Heading } from '../text/heading'; @@ -19,9 +19,8 @@ import { Heading } from '../text/heading'; // Constants const SITE_METADATA = getSiteMetadata(); -const CONTACT_URL = '/#contact'; -const PLACEHOLDER_PHONE = '(***) ***-****'; -const PLACEHOLDER_EMAIL = '*****@*****.com'; +const CONTACT_PATH = '/contact'; +const CONTACT_URL = removeProtocol(getAbsoluteUrl(CONTACT_PATH)); const COMMON_GHOST_BUTTON_LINK_PROPS = { tooltipPosition: TooltipPosition.Left, className: '!p-0', @@ -44,19 +43,21 @@ export function ResumeHeader() {