Skip to content

Commit

Permalink
feat(seo): amélioration du SEO pour la rupture co (#6074)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-maillot authored Aug 13, 2024
1 parent bce5781 commit 9068330
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,9 @@ exports[`<About /> should render 1`] = `
<li>
<a
class="sc-bkSUFG ccAGAe"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2760,9 +2760,9 @@ exports[`<DroitDuTravail /> should render 1`] = `
<li>
<a
class="sc-lbJcrp fVfqop"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,9 +894,9 @@ exports[`<FicheMT /> should render 1`] = `
<li>
<a
class="sc-gJCZQp ixRNIF"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ exports[`<Term /> should render 1`] = `
<li>
<a
class="sc-bkSUFG ccAGAe"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ exports[`<Glossaire /> should render 1`] = `
<li>
<a
class="sc-bkSUFG ccAGAe"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ exports[`<MentionLegales /> should render 1`] = `
<li>
<a
class="sc-bkSUFG ccAGAe"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,9 +868,9 @@ exports[`<ModelesDeCourrier /> should render 1`] = `
<li>
<a
class="sc-bkSUFG ccAGAe"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,9 @@ exports[`<ModelesDeCourriers /> should render 1`] = `
<li>
<a
class="sc-bkSUFG ccAGAe"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ exports[`<Recherche /> should render 1`] = `
<li>
<a
class="sc-bfhvDw iBKSzx"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ exports[`<Stats /> should render 1`] = `
<li>
<a
class="sc-bkSUFG ccAGAe"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@ exports[`<Theme /> should render 1`] = `
<li>
<a
class="sc-epALIP lfqDsR"
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
>
Calcul de l'indemnité de licenciement
Calcul de l'indemnité de rupture conventionnelle
</a>
</li>
<li>
Expand Down
31 changes: 26 additions & 5 deletions packages/code-du-travail-frontend/pages/outils/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import {
SimulateurIndemnitePrecarite,
CalculateurPreavisRetraite,
} from "../../src/outils";
import { getBySlugTools, getBySourceAndSlugItems } from "../../src/api";
import {
getBySlugTools,
getBySourceAndSlugItems,
RelatedItem,
} from "../../src/api";
import { Tool } from "@socialgouv/cdtn-types";

const toolsBySlug = {
Expand Down Expand Up @@ -82,9 +86,10 @@ function Outils({
</ShareContainer>
</Flex>
<RelatedItems items={relatedItems} />
{router.asPath !== "/outils/indemnite-licenciement" && (
<Feedback url={router.asPath} />
)}
{router.asPath !== "/outils/indemnite-licenciement" &&
router.asPath !== "/outils/indemnite-rupture-conventionnelle" && (
<Feedback url={router.asPath} />
)}
</Container>
</div>
</Layout>
Expand Down Expand Up @@ -117,7 +122,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async ({
metaDescription,
} = tool;
const data = await getBySourceAndSlugItems<Tool>(SOURCES.TOOLS, slug);
const relatedItems = data?.relatedItems ?? [];
const relatedItems = filterRelatedItems(slug, data?.relatedItems ?? []);

return {
props: {
Expand All @@ -133,6 +138,22 @@ export const getServerSideProps: GetServerSideProps<Props> = async ({
};
};

/**
* Hack pour éviter que les deux outils ne se référencent pour améliorer la recherche sur Google
*/
const filterRelatedItems = (
slug: string,
relatedItems: RelatedItem[]
): RelatedItem[] =>
slug !== "indemnite-licenciement" &&
slug !== "indemnite-rupture-conventionnelle"
? relatedItems
: relatedItems?.filter(
(item) =>
item.slug !== "indemnite-rupture-conventionnelle" &&
item.slug !== "indemnite-licenciement"
);

const { breakpoints, spacings } = theme;

export const ShareContainer = styled.div`
Expand Down
4 changes: 2 additions & 2 deletions packages/code-du-travail-frontend/src/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ const Footer = (): JSX.Element => {
<li>
<Link
passHref
href="/outils/indemnite-licenciement"
href="/outils/indemnite-rupture-conventionnelle"
legacyBehavior
>
<StyledLink>
Calcul de l&apos;indemnité de licenciement
Calcul de l&apos;indemnité de rupture conventionnelle
</StyledLink>
</Link>
</li>
Expand Down

0 comments on commit 9068330

Please sign in to comment.