From cf296a8f382b875a148703837309118bf286c42e Mon Sep 17 00:00:00 2001 From: Maxime Golfier <25312957+maxgfr@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:53:34 +0100 Subject: [PATCH] fix(fiches-mt): modication de la canonical (#6306) * fix: modif * fix: modif * fix: modif --- .../app/fiche-ministere-travail/[slug]/page.tsx | 5 ++--- .../code-du-travail-frontend/src/modules/common/metas.tsx | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/code-du-travail-frontend/app/fiche-ministere-travail/[slug]/page.tsx b/packages/code-du-travail-frontend/app/fiche-ministere-travail/[slug]/page.tsx index 0cde0b3b73..436dc89f9c 100644 --- a/packages/code-du-travail-frontend/app/fiche-ministere-travail/[slug]/page.tsx +++ b/packages/code-du-travail-frontend/app/fiche-ministere-travail/[slug]/page.tsx @@ -5,15 +5,14 @@ import { generateDefaultMetadata } from "../../../src/modules/common/metas"; import { fetchFicheMT } from "../../../src/modules/fiche-ministere-travail/queries"; import { FicheMinistereTravail } from "../../../src/modules/fiche-ministere-travail/ficheMinistereTravail"; import { fetchRelatedItems } from "../../../src/modules/documents"; -import { getRouteBySource, SOURCES } from "@socialgouv/cdtn-utils"; export async function generateMetadata({ params }) { - const { title, description } = await getFiche(params.slug); + const { title, description, url } = await getFiche(params.slug); return generateDefaultMetadata({ title: title, description: description, - path: `/${getRouteBySource(SOURCES.SHEET_MT)}/${params.slug}`, + overrideCanonical: url, }); } diff --git a/packages/code-du-travail-frontend/src/modules/common/metas.tsx b/packages/code-du-travail-frontend/src/modules/common/metas.tsx index ab8f86b9d5..e7ceb3ccd2 100644 --- a/packages/code-du-travail-frontend/src/modules/common/metas.tsx +++ b/packages/code-du-travail-frontend/src/modules/common/metas.tsx @@ -3,7 +3,7 @@ import { Metadata } from "next/types"; type Props = { title: string; description: string; - path: string; + path?: string; overrideCanonical?: string; noTitleAdd?: boolean; };