diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-29 18:21:37 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-29 19:02:57 +0100 |
| commit | e4d5b8151802517b2943756fc0d09ffa95e2c4e2 (patch) | |
| tree | 9e99137a7b64ea7993a8311a7162336a551be8b2 /src/pages/cv.tsx | |
| parent | 47b854de26dea24e7838fd0804df103dee99635f (diff) | |
chore: replace lingui functions with react-intl
Diffstat (limited to 'src/pages/cv.tsx')
| -rw-r--r-- | src/pages/cv.tsx | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/src/pages/cv.tsx b/src/pages/cv.tsx index a851c38..c3686de 100644 --- a/src/pages/cv.tsx +++ b/src/pages/cv.tsx @@ -2,10 +2,8 @@ import { getLayout } from '@components/Layouts/Layout'; import PostHeader from '@components/PostHeader/PostHeader'; import Sidebar from '@components/Sidebar/Sidebar'; import { CVPreview, SocialMedia, ToC } from '@components/Widgets'; -import { seo } from '@config/seo'; import { config } from '@config/website'; import CVContent, { intro, meta, pdf, image } from '@content/pages/cv.mdx'; -import { t } from '@lingui/macro'; import styles from '@styles/pages/Page.module.scss'; import { NextPageWithLayout } from '@ts/types/app'; import { ArticleMeta } from '@ts/types/articles'; @@ -13,9 +11,11 @@ import { loadTranslation } from '@utils/helpers/i18n'; import { GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import { useIntl } from 'react-intl'; import { AboutPage, Graph, WebPage } from 'schema-dts'; const CV: NextPageWithLayout = () => { + const intl = useIntl(); const router = useRouter(); const dates = { publication: meta.publishedOn, @@ -26,13 +26,28 @@ const CV: NextPageWithLayout = () => { dates, }; const pageUrl = `${config.url}${router.asPath}`; + const pageTitle = intl.formatMessage( + { + defaultMessage: 'CV Front-end developer - {websiteName}', + description: 'CVPage: SEO - Page title', + }, + { websiteName: config.name } + ); + const pageDescription = intl.formatMessage( + { + defaultMessage: + 'Discover the curriculum of {websiteName}, front-end developer located in France: skills, experiences and training.', + description: 'CVPage: SEO - Meta description', + }, + { websiteName: config.name } + ); const webpageSchema: WebPage = { '@id': `${pageUrl}`, '@type': 'WebPage', breadcrumb: { '@id': `${config.url}/#breadcrumb` }, - name: seo.cv.title, - description: seo.cv.description, + name: pageTitle, + description: pageDescription, reviewedBy: { '@id': `${config.url}/#branding` }, url: `${pageUrl}`, isPartOf: { @@ -46,7 +61,7 @@ const CV: NextPageWithLayout = () => { const cvSchema: AboutPage = { '@id': `${config.url}/#cv`, '@type': 'AboutPage', - name: `${config.name} CV`, + name: pageTitle, description: intro, author: { '@id': `${config.url}/#branding` }, creator: { '@id': `${config.url}/#branding` }, @@ -66,17 +81,25 @@ const CV: NextPageWithLayout = () => { '@graph': [webpageSchema, cvSchema], }; + const title = intl.formatMessage( + { + defaultMessage: "{name}'s CV", + description: 'CVPage: page title', + }, + { name: config.name } + ); + return ( <> <Head> - <title>{seo.cv.title}</title> - <meta name="description" content={seo.cv.description} /> + <title>{pageTitle}</title> + <meta name="description" content={pageDescription} /> <meta property="og:url" content={`${pageUrl}`} /> <meta property="og:type" content="article" /> - <meta property="og:title" content={`${config.name} CV`} /> + <meta property="og:title" content={title} /> <meta property="og:description" content={intro} /> <meta property="og:image" content={image} /> - <meta property="og:image:alt" content={`${config.name} CV`} /> + <meta property="og:image:alt" content={title} /> <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} @@ -94,9 +117,19 @@ const CV: NextPageWithLayout = () => { <CVContent /> </div> <Sidebar position="right"> - <CVPreview title={t`Other formats`} imgSrc={image} pdf={pdf} /> + <CVPreview + title={intl.formatMessage({ + defaultMessage: 'Others formats', + description: 'CVPage: cv preview widget title', + })} + imgSrc={image} + pdf={pdf} + /> <SocialMedia - title={t`Open-source projects`} + title={intl.formatMessage({ + defaultMessage: 'Open-source projects', + description: 'CVPage: social media widget title', + })} github={true} gitlab={true} /> |
