+Head.jsx is ignored for parametrized (@slug) routes in an SSG setup #2615
Unanswered
adrai
asked this question in
Help & Questions
Replies: 1 comment 19 replies
-
Are you using |
Beta Was this translation helpful? Give feedback.
19 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Vike team,
I’m experiencing an issue where the
+Head.jsx
file is ignored for parametrized routes (e.g./pages/blog/@slug/+Head.jsx
).For static routes, the head tags are rendered as expected, but for dynamic routes like
/blog/[slug]
, the<title>
and meta tags from+Head.jsx
do not appear in the HTML output (SSR/SSG).What I’ve tried:
+Head.jsx
is present and correctly exports a React component usinguseData()
.export { LayoutBlogPost as Layout }
and uses the correct signature:({ children, pageContext })
.pageContext
is always undefined in the layout for dynamic routes.+onCreatePageContext.js
to the route, but it did not resolve the issue.vike
,vike-react
, andreact-head
.Expected:
The head tags defined in
+Head.jsx
should be rendered for dynamic routes, just like for static routes.Actual:
Head tags of the parent
+Head.jsx
page are used for dynamic routes, andpageContext
is undefined in the layout.Repro steps:
/pages/blog/@slug/+Page.jsx
and/pages/blog/@slug/+Head.jsx
)+Head.jsx
+Head.jsx
page are used for/blog/[slug]
pagesAny ideas or workarounds? Is this a bug or am I missing a configuration step?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions