diff options
Diffstat (limited to 'src/pages/mentions-legales.tsx')
| -rw-r--r-- | src/pages/mentions-legales.tsx | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx index c9d2ccd..0ec92a2 100644 --- a/src/pages/mentions-legales.tsx +++ b/src/pages/mentions-legales.tsx @@ -1,24 +1,24 @@ import { getLayout } from '@components/Layouts/Layout'; -import { seo } from '@config/seo'; -import { NextPageWithLayout } from '@ts/types/app'; -import { defaultLocale, loadTranslation } from '@utils/helpers/i18n'; -import { GetStaticProps, GetStaticPropsContext } from 'next'; -import Head from 'next/head'; +import PostHeader from '@components/PostHeader/PostHeader'; +import Sidebar from '@components/Sidebar/Sidebar'; +import { ToC } from '@components/Widgets'; +import { config } from '@config/website'; import LegalNoticeContent, { intro, meta, } from '@content/pages/legal-notice.mdx'; -import PostHeader from '@components/PostHeader/PostHeader'; -import { ArticleMeta } from '@ts/types/articles'; import styles from '@styles/pages/Page.module.scss'; -import { ToC } from '@components/Widgets'; -import Sidebar from '@components/Sidebar/Sidebar'; -import { Article, Graph, WebPage } from 'schema-dts'; -import { config } from '@config/website'; +import { NextPageWithLayout } from '@ts/types/app'; +import { ArticleMeta } from '@ts/types/articles'; +import { loadTranslation } from '@utils/helpers/i18n'; +import { GetStaticProps, GetStaticPropsContext } from 'next'; +import Head from 'next/head'; import { useRouter } from 'next/router'; -import { t } from '@lingui/macro'; +import { useIntl } from 'react-intl'; +import { Article, Graph, WebPage } from 'schema-dts'; const LegalNotice: NextPageWithLayout = () => { + const intl = useIntl(); const router = useRouter(); const dates = { publication: meta.publishedOn, @@ -28,8 +28,25 @@ const LegalNotice: NextPageWithLayout = () => { const pageMeta: ArticleMeta = { dates, }; + const pageTitle = intl.formatMessage( + { + defaultMessage: 'Legal notice - {websiteName}', + description: 'LegalNoticePage: SEO - Page title', + }, + { websiteName: config.name } + ); + const pageDescription = intl.formatMessage( + { + defaultMessage: "Discover the legal notice of {websiteName}'s website.", + description: 'LegalNoticePage: SEO - Meta description', + }, + { websiteName: config.name } + ); const pageUrl = `${config.url}${router.asPath}`; - + const title = intl.formatMessage({ + defaultMessage: 'Legal notice', + description: 'LegalNoticePage: page title', + }); const publicationDate = new Date(dates.publication); const updateDate = new Date(dates.update); @@ -37,8 +54,8 @@ const LegalNotice: NextPageWithLayout = () => { '@id': `${pageUrl}`, '@type': 'WebPage', breadcrumb: { '@id': `${config.url}/#breadcrumb` }, - name: seo.legalNotice.title, - description: seo.legalNotice.description, + name: pageTitle, + description: pageDescription, inLanguage: config.locales.defaultLocale, license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', reviewedBy: { '@id': `${config.url}/#branding` }, @@ -51,7 +68,7 @@ const LegalNotice: NextPageWithLayout = () => { const articleSchema: Article = { '@id': `${config.url}/#legal-notice`, '@type': 'Article', - name: t`Legal notice`, + name: title, description: intro, author: { '@id': `${config.url}/#branding` }, copyrightYear: publicationDate.getFullYear(), @@ -73,11 +90,11 @@ const LegalNotice: NextPageWithLayout = () => { return ( <> <Head> - <title>{seo.legalNotice.title}</title> - <meta name="description" content={seo.legalNotice.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={t`Legal notice`} /> + <meta property="og:title" content={pageTitle} /> <meta property="og:description" content={intro} /> <script type="application/ld+json" @@ -107,7 +124,7 @@ export const getStaticProps: GetStaticProps = async ( ) => { const breadcrumbTitle = meta.title; const { locale } = context; - const translation = await loadTranslation(locale || defaultLocale); + const translation = await loadTranslation(locale); return { props: { |
