Remove dynamic translation in Meta component
parent
a0e4f2f8d0
commit
0eabc48c8c
|
@ -98,4 +98,6 @@ export default {
|
|||
|
||||
verbose: false,
|
||||
// Display info about the parsing including some stats
|
||||
|
||||
failOnWarnings: true,
|
||||
}
|
||||
|
|
|
@ -10,10 +10,14 @@ import { Emoji } from '@/design-system/emoji'
|
|||
import { Spacing } from '@/design-system/layout'
|
||||
import { H1 } from '@/design-system/typography/heading'
|
||||
import { Intro } from '@/design-system/typography/paragraphs'
|
||||
import { useCurrentSimulatorData } from '@/hooks/useCurrentSimulatorData'
|
||||
import {
|
||||
MergedSimulatorDataValues,
|
||||
useCurrentSimulatorData,
|
||||
} from '@/hooks/useCurrentSimulatorData'
|
||||
import { useIsEmbedded } from '@/hooks/useIsEmbedded'
|
||||
import useSimulationConfig from '@/hooks/useSimulationConfig'
|
||||
import { situationSelector } from '@/store/selectors/simulationSelectors'
|
||||
import { Merge, ToOptional } from '@/types/utils'
|
||||
|
||||
import { NextSteps } from '../pages/simulateurs/NextSteps'
|
||||
import { TrackChapter } from './ATInternetTracking'
|
||||
|
@ -57,9 +61,21 @@ export default function PageData() {
|
|||
...(typeof tracking === 'string' ? { chapter2: tracking } : tracking),
|
||||
} as ComponentPropsWithoutRef<typeof TrackChapter>
|
||||
|
||||
const { ogTitle, ogDescription, ogImage } = meta as Merge<
|
||||
MergedSimulatorDataValues['meta']
|
||||
>
|
||||
|
||||
return (
|
||||
<TrackChapter {...trackInfo}>
|
||||
{meta && <Meta page={`simulateur.${title ?? ''}`} {...meta} />}
|
||||
{meta && (
|
||||
<Meta
|
||||
title={meta.title}
|
||||
description={meta.description}
|
||||
ogTitle={ogTitle}
|
||||
ogDescription={ogDescription}
|
||||
ogImage={ogImage}
|
||||
/>
|
||||
)}
|
||||
|
||||
{beta && <BetaBanner />}
|
||||
{title && !inIframe && (
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import DefaultHelmet from './DefaultHelmet'
|
||||
|
||||
type PropType = {
|
||||
page: string
|
||||
title: string
|
||||
description: string
|
||||
ogDescription?: string
|
||||
|
@ -12,44 +9,27 @@ type PropType = {
|
|||
}
|
||||
|
||||
export default function Meta({
|
||||
page,
|
||||
title,
|
||||
description,
|
||||
ogDescription,
|
||||
ogTitle,
|
||||
ogImage,
|
||||
}: PropType) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
// TODO: refacto des traductions en évitant qu'elles soit dynamique
|
||||
const meta = {
|
||||
title,
|
||||
description: t(`${page}.description`, description) || description,
|
||||
ogDescription: ogDescription
|
||||
? t(`${page}.ogDescription`, ogDescription) || ogDescription
|
||||
: description,
|
||||
ogTitle: ogTitle ? t(`${page}.ogTitle`, ogTitle) || ogTitle : title,
|
||||
ogImage: ogImage ? t(`${page}.ogImage`, ogImage) || ogImage : null,
|
||||
}
|
||||
|
||||
return (
|
||||
<DefaultHelmet>
|
||||
<title>{meta.title}</title>
|
||||
<meta name="description" content={meta.description} />
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={description} />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content={meta.ogTitle ?? meta.title} />
|
||||
<meta
|
||||
property="og:description"
|
||||
content={meta.ogDescription ?? meta.description}
|
||||
/>
|
||||
{meta.ogImage && (
|
||||
<meta property="og:title" content={ogTitle || title} />
|
||||
<meta property="og:description" content={ogDescription || description} />
|
||||
{ogImage && (
|
||||
<meta
|
||||
property="og:image"
|
||||
content={
|
||||
meta.ogImage.startsWith('http')
|
||||
? meta.ogImage
|
||||
ogImage.startsWith('http')
|
||||
? ogImage
|
||||
: (typeof window !== 'undefined' ? window.location.host : '') +
|
||||
meta.ogImage
|
||||
ogImage
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
|
|
@ -15,7 +15,6 @@ export default function Accessibilité() {
|
|||
<Trans i18nKey="pages.accessibilité">
|
||||
<H1>Accessibilité</H1>
|
||||
<Meta
|
||||
page="accessibilité"
|
||||
title={t('accessibility.title', 'Accessibilité')}
|
||||
description={t(
|
||||
'accessibility.description',
|
||||
|
|
|
@ -165,7 +165,6 @@ function DocumentationLanding() {
|
|||
<>
|
||||
<TrackPage chapter1="documentation" name="accueil" />
|
||||
<Meta
|
||||
page="documentation"
|
||||
title={t('documentation.title', 'Documentation')}
|
||||
description={t(
|
||||
'documentation.description',
|
||||
|
|
|
@ -21,7 +21,6 @@ export default function Plan() {
|
|||
<Trans i18nKey={'sitemap.title'}>Plan du site</Trans>
|
||||
</H1>
|
||||
<Meta
|
||||
page="plan-du-site"
|
||||
title={t('sitemap.title', 'Plan du site')}
|
||||
description={t(
|
||||
'sitemap.description',
|
||||
|
|
|
@ -31,7 +31,6 @@ export default function Landing() {
|
|||
<>
|
||||
<TrackPage chapter1="informations" name="accueil" />
|
||||
<Meta
|
||||
page="landing"
|
||||
title=""
|
||||
description={t(
|
||||
'landing.description',
|
||||
|
|
|
@ -32,7 +32,6 @@ export default function ChoixStatutJuridique() {
|
|||
<FromBottom>
|
||||
<TrackPage name="accueil" />
|
||||
<Meta
|
||||
page="créer"
|
||||
title={t('créer.titre', 'Créer une entreprise')}
|
||||
description={t('créer.description', 'Créer une entreprise')}
|
||||
ogImage={créerSvg}
|
||||
|
|
|
@ -63,7 +63,6 @@ export default function Budget() {
|
|||
<>
|
||||
<TrackPage chapter1="informations" name="budget" />
|
||||
<Meta
|
||||
page="budget"
|
||||
title={t('budget.title', 'Budget')}
|
||||
description={t('budget.description', 'Le budget de mon-entreprise')}
|
||||
/>
|
||||
|
|
|
@ -21,7 +21,6 @@ export default function API() {
|
|||
<div css="iframe{margin-top: 1em; margin-bottom: 1em}">
|
||||
<ScrollToTop />
|
||||
<Meta
|
||||
page="api"
|
||||
title={t('api.title', 'Utiliser notre API REST')}
|
||||
description={t('api.description', 'Outils pour les développeurs')}
|
||||
/>
|
||||
|
|
|
@ -100,7 +100,6 @@ function IntegrationCustomizer() {
|
|||
<Trans>Personnalisez l'intégration</Trans>
|
||||
</H2>
|
||||
<Meta
|
||||
page="iframe"
|
||||
title={t('iframe.title', 'Intégrer un simulateur')}
|
||||
description={t('iframe.description', 'Outils pour les développeurs')}
|
||||
/>
|
||||
|
|
|
@ -21,7 +21,6 @@ export default function Library() {
|
|||
return (
|
||||
<div css="iframe{margin-top: 1em; margin-bottom: 1em}">
|
||||
<Meta
|
||||
page="library"
|
||||
title={t('library.title', 'Librairie de calcul')}
|
||||
description={t('library.description', 'Outils pour les développeurs')}
|
||||
/>
|
||||
|
|
|
@ -18,7 +18,6 @@ export default function Options() {
|
|||
return (
|
||||
<>
|
||||
<Meta
|
||||
page="intégration"
|
||||
title={t('intégration.title', 'Intégration')}
|
||||
description={t(
|
||||
'intégration.description',
|
||||
|
|
|
@ -17,7 +17,6 @@ export default function Spreadsheet() {
|
|||
<div css="iframe{margin-top: 1em; margin-bottom: 1em}">
|
||||
<ScrollToTop />
|
||||
<Meta
|
||||
page="spreadsheet"
|
||||
title={t('spreadsheet.title', 'Utiliser avec un tableur')}
|
||||
description={t(
|
||||
'spreadsheet.description',
|
||||
|
|
|
@ -59,7 +59,6 @@ export default function Nouveautés() {
|
|||
<>
|
||||
<TrackPage chapter1="informations" name="nouveautes" />
|
||||
<Meta
|
||||
page="nouveautés"
|
||||
title={t('news.title', 'Nouveautés')}
|
||||
description={t(
|
||||
'news.description',
|
||||
|
|
|
@ -31,7 +31,6 @@ export default function SimulateursEtAssistants() {
|
|||
<>
|
||||
<TrackPage chapter1="simulateurs" name="accueil" />
|
||||
<Meta
|
||||
page="simulateurs"
|
||||
title={titre}
|
||||
description={t(
|
||||
'pages.simulateurs.accueil.description',
|
||||
|
|
|
@ -21,7 +21,6 @@ export default function StatsPage() {
|
|||
<>
|
||||
<TrackPage chapter1="informations" name="stats" />
|
||||
<Meta
|
||||
page="stats"
|
||||
title={t('stats.title', 'Statistiques')}
|
||||
description={t(
|
||||
'stats.description',
|
||||
|
|
Loading…
Reference in New Issue