From bd2ee81ff4c0e7381bb9fb7bf06c3109efa32190 Mon Sep 17 00:00:00 2001 From: Bram van der Holst Date: Fri, 12 Jun 2026 13:26:32 +0200 Subject: [PATCH] fix: fetch globalConfig on blog pages so global content renders Blog pages never fetched the global config in getStaticProps, so GlobalConfigProvider received undefined and the footer rendered empty. Add fetchGlobalConfig + globalConfig prop to the blog index/post/tagged pages, matching the pattern in pages/[...url].tsx. --- .changeset/mighty-pans-stick.md | 5 +++++ examples/magento-storyblok/pages/blog/[...url].tsx | 4 +++- examples/magento-storyblok/pages/blog/page/[page].tsx | 4 +++- examples/magento-storyblok/pages/blog/tagged/[url].tsx | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/mighty-pans-stick.md diff --git a/.changeset/mighty-pans-stick.md b/.changeset/mighty-pans-stick.md new file mode 100644 index 0000000000..f496567989 --- /dev/null +++ b/.changeset/mighty-pans-stick.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/magento-storyblok': patch +--- + +Fixed empty footer on blog pages diff --git a/examples/magento-storyblok/pages/blog/[...url].tsx b/examples/magento-storyblok/pages/blog/[...url].tsx index 14c2cfbe4b..5064bec8c8 100644 --- a/examples/magento-storyblok/pages/blog/[...url].tsx +++ b/examples/magento-storyblok/pages/blog/[...url].tsx @@ -30,7 +30,7 @@ import { BlogList, LayoutDocument, LayoutNavigation } from '../../components' import type { LayoutNavigationProps } from '../../components' import { RowRenderer } from '../../components/Storyblok/RowRenderer' import { graphqlSharedClient, graphqlSsrClient } from '../../lib/graphql/graphqlSsrClient' -import { useStoryblokState } from '../../lib/storyblok' +import { fetchGlobalConfig, useStoryblokState } from '../../lib/storyblok' type Props = { story: StoryblokStory | null; related: StoryblokStory[] } type RouteProps = { url: string[] } @@ -140,6 +140,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { fetchPolicy: cacheFirst(staticClient), }) + const globalConfig = fetchGlobalConfig(context) const storyPage = fetchStory(slug, context, staticClient) const related = fetchStories({ starts_with: 'blog/', @@ -156,6 +157,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { story, related: (await related).stories, ...(await layout).data, + globalConfig: (await globalConfig)?.content ?? null, up: { href: '/blog', title: t`Blog` }, apolloState: await conf.then(() => client.cache.extract()), }, diff --git a/examples/magento-storyblok/pages/blog/page/[page].tsx b/examples/magento-storyblok/pages/blog/page/[page].tsx index f2e67812cd..efcf50ba2e 100644 --- a/examples/magento-storyblok/pages/blog/page/[page].tsx +++ b/examples/magento-storyblok/pages/blog/page/[page].tsx @@ -24,7 +24,7 @@ import { BlogList, LayoutDocument, LayoutNavigation } from '../../../components' import type { LayoutNavigationProps } from '../../../components' import { RowRenderer } from '../../../components/Storyblok/RowRenderer' import { graphqlSharedClient, graphqlSsrClient } from '../../../lib/graphql/graphqlSsrClient' -import { useStoryblokState } from '../../../lib/storyblok' +import { fetchGlobalConfig, useStoryblokState } from '../../../lib/storyblok' type Props = { story: StoryblokStory | null @@ -116,6 +116,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { fetchPolicy: cacheFirst(staticClient), }) + const globalConfig = fetchGlobalConfig(context) const landingStory = fetchStory('blog', context, staticClient) const blogList = fetchStories({ starts_with: 'blog/', @@ -136,6 +137,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { total, perPage, ...(await layout).data, + globalConfig: (await globalConfig)?.content ?? null, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-storyblok/pages/blog/tagged/[url].tsx b/examples/magento-storyblok/pages/blog/tagged/[url].tsx index 3a265c983b..31352866a2 100644 --- a/examples/magento-storyblok/pages/blog/tagged/[url].tsx +++ b/examples/magento-storyblok/pages/blog/tagged/[url].tsx @@ -20,6 +20,7 @@ import type { GetStaticPaths } from 'next' import { BlogList, LayoutDocument, LayoutNavigation } from '../../../components' import type { LayoutNavigationProps } from '../../../components' import { graphqlSharedClient, graphqlSsrClient } from '../../../lib/graphql/graphqlSsrClient' +import { fetchGlobalConfig } from '../../../lib/storyblok' type Props = { tag: string; stories: StoryblokStory[] } type RouteProps = { url: string } @@ -98,6 +99,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { fetchPolicy: cacheFirst(staticClient), }) + const globalConfig = fetchGlobalConfig(context) const stories = await fetchAllStories({ starts_with: 'blog/', excluding_slugs: 'blog/,blog/tagged/*', @@ -113,6 +115,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { tag, stories, ...(await layout).data, + globalConfig: (await globalConfig)?.content ?? null, up: { href: '/blog', title: t`Blog` }, apolloState: await conf.then(() => client.cache.extract()), },