📈 Ajout lang dans la balise <html>
L'élément <html> n'a pas d'attribut [lang]pull/1795/head
parent
27575e039a
commit
9efcc0e892
|
@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
|
|||
import { useLocation } from 'react-router'
|
||||
|
||||
type PropType = {
|
||||
page: string,
|
||||
page: string
|
||||
title: string
|
||||
description: string
|
||||
ogDescription?: string
|
||||
|
@ -20,21 +20,26 @@ export default function Meta({
|
|||
ogImage,
|
||||
}: PropType) {
|
||||
const { pathname } = useLocation()
|
||||
const { t } = useTranslation()
|
||||
const { t, i18n } = useTranslation()
|
||||
const meta = {
|
||||
title: t(`${page}.titre`, title) || title,
|
||||
description: t(`${page}.description`, description) || description,
|
||||
ogDescription: ogDescription ? t(`${page}.ogDescription`, ogDescription) || ogDescription : 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 (
|
||||
<Helmet>
|
||||
<Helmet htmlAttributes={{ lang: i18n.language }}>
|
||||
<title>{meta.title}</title>
|
||||
<meta name="description" content={meta.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
|
||||
property="og:description"
|
||||
content={meta.ogDescription ?? meta.description}
|
||||
/>
|
||||
{meta.ogImage && (
|
||||
<meta
|
||||
property="og:image"
|
||||
|
|
Loading…
Reference in New Issue