CLOSED[Umbrella] remove SitePage nodes #29233
Replies: 2 comments 1 reply
-
Does this mean we no longer have access to Because I added the exports.onPostBootstrap = ({ getNodes, reporter }) => {
reporter.info(`onPostBootstrap`)
const paths = getNodes()
.filter((n) => n.internal.type === `SitePage`)
.map((n) => n.path)
console.log(paths)
} |
Beta Was this translation helpful? Give feedback.
-
Does this mean exports.onCreatePage = ({ page, actions: { createPage, deletePage } }) => {
const path = stripTrailingSlash(page.path)
deletePage(page)
createPage({
...page,
path,
})
} I use this not only to remove trailing slashes, but also to add page context to create pages. I hope this is not going to be deprecated. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We're deprecating creating SitePage nodes and will remove in v3. The reason is that we already create objects for pages so also creating SitePage nodes is redundant work and gets costly as a site's page count grows.
You can still query
sitePage
andallSitePage
in the graphql schema so plugins requesting that data should still work as before. NOTE the filtering/sorting operators that are normally on Gatsby's graphql types has not yet been added to these. If you need one of the operators added to use this, let us know in a comments so we can fast track adding it.PR implemented in #29201
How to test
Add the
NO_PAGE_NODES
flag to yourgatsby-config.js
:Beta Was this translation helpful? Give feedback.
All reactions