Replies: 1 comment
-
Might be a duplicate of #11272? |
Beta Was this translation helpful? Give feedback.
0 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.
-
Suppose I have a slug for my website
/en/blog/post-1
matching the dynamic route/[lang]/blog/[post]
, and I'm using Next.js to export the blog post page at build time usinggetStaticProps
andgetStaticPaths
.The dilemma I am facing is as follows: Inside
getStaticPaths
I query a CMS for all posts, their language and SEO-slug ([lang]
,[post]
), to generate an index for the pages and pass these asparams
togetStaticProps
. Inside, I not want to query only the single post that is being created right now but to do that I need to know theuid
of the post. I can query that ingetStaticPaths
alongside with the other data, but I haven't yet found a way to pass it intogetStaticProps
since it's not part of the route (and it shouln't be for SEO purposes).Has anyone experienced something similar or knows of a workaround? Essentially, I am looking for a way to inject data into
context
from withingetStaticPaths
.Cheers, Simon
Beta Was this translation helpful? Give feedback.
All reactions