Replies: 1 comment
-
I think you are looking for page context Pass context to pages
On your pages and templates, you can access your context via the prop pageContext like this:
Page context is serialized before being passed to pages. This means it can’t be used to pass functions into components and Date objects will be serialized into strings. |
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
-
I have a Gatsby v5 site with Sanity as a CMS. All of my pages are static. Some pages are hardcoded through Gatsby /pages and the remaining are generated by data from Sanity at the build time.
I want to have a feature where I can put a placeholder text like
{current_year}
in the hardcoded pages or in Sanity content blocks and it should be replaced with 2024 (usingnew Date().getFullYear().toString()
) at build time.Can we use onCreateWebpackConfig or onCreateBabelConfig or using any other lifecycle method?
Grateful for any help/suggestions/lead 🙌🏾
Beta Was this translation helpful? Give feedback.
All reactions