From c51b5d9a5f217f8aa59c4bdcb04eb3c87f5129b3 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 23 May 2022 19:32:42 +0200 Subject: fix: ensure all topics/thematics have the base url --- src/pages/404.tsx | 8 ++++---- src/pages/article/[slug].tsx | 8 ++------ src/pages/blog/index.tsx | 8 ++++---- src/pages/blog/page/[number].tsx | 8 ++++---- src/pages/recherche/index.tsx | 8 ++++---- src/pages/sujet/[slug].tsx | 8 ++++---- src/pages/thematique/[slug].tsx | 9 +++++---- 7 files changed, 27 insertions(+), 30 deletions(-) (limited to 'src/pages') diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 4ab7784..fd7187a 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -98,8 +98,9 @@ const Error404Page: NextPageWithLayout = ({ + getPageLinkFromRawData(thematic, 'thematic') + ) )} title={thematicsListTitle} level={2} @@ -107,8 +108,7 @@ const Error404Page: NextPageWithLayout = ({ getPageLinkFromRawData(topic, 'topic')) )} title={topicsListTitle} level={2} diff --git a/src/pages/article/[slug].tsx b/src/pages/article/[slug].tsx index c72d48e..5e75ae7 100644 --- a/src/pages/article/[slug].tsx +++ b/src/pages/article/[slug].tsx @@ -81,7 +81,7 @@ const ArticlePage: NextPageWithLayout = ({ thematics: thematics && thematics.map((thematic) => ( - + {thematic.name} )), @@ -99,11 +99,7 @@ const ArticlePage: NextPageWithLayout = ({ label: footerMetaLabel, value: topics.map((topic) => { return ( - + {topic.logo && } {topic.name} ); diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx index cfd6f8c..3956308 100644 --- a/src/pages/blog/index.tsx +++ b/src/pages/blog/index.tsx @@ -153,8 +153,9 @@ const BlogPage: NextPageWithLayout = ({ + getPageLinkFromRawData(thematic, 'thematic') + ) )} title={thematicsListTitle} level={2} @@ -162,8 +163,7 @@ const BlogPage: NextPageWithLayout = ({ getPageLinkFromRawData(topic, 'topic')) )} title={topicsListTitle} level={2} diff --git a/src/pages/blog/page/[number].tsx b/src/pages/blog/page/[number].tsx index 78b1db4..b5efd27 100644 --- a/src/pages/blog/page/[number].tsx +++ b/src/pages/blog/page/[number].tsx @@ -148,8 +148,9 @@ const BlogPage: NextPageWithLayout = ({ + getPageLinkFromRawData(thematic, 'thematic') + ) )} title={thematicsListTitle} level={2} @@ -157,8 +158,7 @@ const BlogPage: NextPageWithLayout = ({ getPageLinkFromRawData(topic, 'topic')) )} title={topicsListTitle} level={2} diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx index ab619fb..ffdbf44 100644 --- a/src/pages/recherche/index.tsx +++ b/src/pages/recherche/index.tsx @@ -165,8 +165,9 @@ const SearchPage: NextPageWithLayout = ({ + getPageLinkFromRawData(thematic, 'thematic') + ) )} title={thematicsListTitle} level={2} @@ -174,8 +175,7 @@ const SearchPage: NextPageWithLayout = ({ getPageLinkFromRawData(topic, 'topic')) )} title={topicsListTitle} level={2} diff --git a/src/pages/sujet/[slug].tsx b/src/pages/sujet/[slug].tsx index 838f009..5c86720 100644 --- a/src/pages/sujet/[slug].tsx +++ b/src/pages/sujet/[slug].tsx @@ -138,13 +138,13 @@ const TopicPage: NextPageWithLayout = ({ ? [ , , @@ -198,10 +198,10 @@ export const getStaticProps: GetStaticProps = async ({ first: totalTopics, }); const allTopics = allTopicsEdges.edges.map((edge) => - getPageLinkFromRawData(edge.node) + getPageLinkFromRawData(edge.node, 'topic') ); const topicsLinks = allTopics.filter( - (topic) => topic.slug !== (params!.slug as TopicParams['slug']) + (topic) => topic.url !== `/sujet/${params!.slug as TopicParams['slug']}` ); const translation = await loadTranslation(locale); diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx index 84ab134..0519731 100644 --- a/src/pages/thematique/[slug].tsx +++ b/src/pages/thematique/[slug].tsx @@ -118,13 +118,13 @@ const ThematicPage: NextPageWithLayout = ({ ? [ , , @@ -178,10 +178,11 @@ export const getStaticProps: GetStaticProps = async ({ first: totalThematics, }); const allThematics = allThematicsEdges.edges.map((edge) => - getPageLinkFromRawData(edge.node) + getPageLinkFromRawData(edge.node, 'thematic') ); const allThematicsLinks = allThematics.filter( - (thematic) => thematic.slug !== (params!.slug as ThematicParams['slug']) + (thematic) => + thematic.url !== `/thematique/${params!.slug as ThematicParams['slug']}` ); const translation = await loadTranslation(locale); -- cgit v1.2.3