diff --git a/mon-entreprise/source/components/utils/Meta.tsx b/mon-entreprise/source/components/utils/Meta.tsx index ba2e48a2c..0111ffa06 100644 --- a/mon-entreprise/source/components/utils/Meta.tsx +++ b/mon-entreprise/source/components/utils/Meta.tsx @@ -1,7 +1,9 @@ import { Helmet } from 'react-helmet' +import { useTranslation } from 'react-i18next' import { useLocation } from 'react-router' type PropType = { + page: string, title: string description: string ogDescription?: string @@ -10,6 +12,7 @@ type PropType = { } export default function Meta({ + page, title, description, ogDescription, @@ -17,20 +20,28 @@ export default function Meta({ ogImage, }: PropType) { const { pathname } = useLocation() + const { t } = useTranslation() + const meta = { + title: t(`${page}.titre`, title) || 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 ( - {title} - + {meta.title} + - - - {ogImage && ( + + + {meta.ogImage && ( )}