Skip to content

Commit

Permalink
Fix page slug
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinkipruto committed Oct 23, 2024
1 parent 76bf9de commit 0acf0b3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions apps/climatemappedafrica/src/lib/data/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand All @@ -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 {
Expand Down

0 comments on commit 0acf0b3

Please sign in to comment.