diff --git a/apps/codeforafrica/src/lib/data/blockify/index.js b/apps/codeforafrica/src/lib/data/blockify/index.js index 3f76fe17b..0abba5c8c 100644 --- a/apps/codeforafrica/src/lib/data/blockify/index.js +++ b/apps/codeforafrica/src/lib/data/blockify/index.js @@ -12,13 +12,13 @@ const propsifyBlockBySlug = { stories, }; -async function blockify(blocks, api) { +async function blockify(blocks, api, context) { const promises = blocks?.map(async (block) => { const slug = block.blockType; const propsifyBlock = propsifyBlockBySlug[slug]; if (propsifyBlock) { - return propsifyBlock(block, api); + return propsifyBlock(block, api, context); } return { ...block, diff --git a/apps/codeforafrica/src/lib/data/blockify/stories.js b/apps/codeforafrica/src/lib/data/blockify/stories.js index 317836bc4..f80e0b402 100644 --- a/apps/codeforafrica/src/lib/data/blockify/stories.js +++ b/apps/codeforafrica/src/lib/data/blockify/stories.js @@ -3,7 +3,8 @@ import { formatStory, } from "@/codeforafrica/lib/data/utils/stories"; -async function stories(block, api) { +async function stories(block, api, context) { + const { query } = context; const { featured, title, labels } = block; const featuredStory = featured && (formatStory(featured) || null); const featuredStorySlug = featuredStory @@ -18,6 +19,7 @@ async function stories(block, api) { }, }, }), + ...query, }; const { diff --git a/apps/codeforafrica/src/lib/data/common/index.js b/apps/codeforafrica/src/lib/data/common/index.js index 185b46a29..0fad1a51b 100644 --- a/apps/codeforafrica/src/lib/data/common/index.js +++ b/apps/codeforafrica/src/lib/data/common/index.js @@ -157,7 +157,7 @@ export async function getPageProps(api, context) { if (params?.slugs?.length > 2) { page = await pagify(page, api, context); } - const blocks = await blockify(page?.blocks, api); + const blocks = await blockify(page?.blocks, api, context); const settings = await api.findGlobal("settings"); const navbar = getNavBar(settings); const footer = getFooter(settings);