From 0acf0b332effc973e7cbf3600de17797b65f25de Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:33:01 +0300 Subject: [PATCH] Fix page slug --- .../climatemappedafrica/src/lib/data/common/index.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/climatemappedafrica/src/lib/data/common/index.js b/apps/climatemappedafrica/src/lib/data/common/index.js index fa37fc1a7..e6b4ce82e 100644 --- a/apps/climatemappedafrica/src/lib/data/common/index.js +++ b/apps/climatemappedafrica/src/lib/data/common/index.js @@ -76,9 +76,9 @@ async function processExplorePage(slugs, hurumap, explorePage) { export async function getPageProps(api, context) { // For now, ClimatemappedAfrica only supports single paths i.e. /, /about, etc., - // so params.slug[0] is good enough - const slugs = context.params?.slug || undefined; - const [slug] = slugs || ["index"]; + // so params.slugs[0] is good enough + const slugs = context.params?.slugs || ["index"]; + const [slug] = slugs; const { draftMode = false } = context; const options = { draft: draftMode }; @@ -103,11 +103,7 @@ export async function getPageProps(api, context) { const menus = getNavBar(siteSettings, variant, explorePage); if (slug === explorePage.slug) { - blocks = await processExplorePage( - slugs?.slice(1) || [], - hurumap, - explorePage, - ); + blocks = await processExplorePage(slugs.slice(1), hurumap, explorePage); } return {