Option to skip pages created via filesystem routing #36853
Unanswered
tsdexter
asked this question in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Maybe I missed it, but it looks like in order to continue using the filesystem route instead of resorting to
createPage
, I need the ability to skip some pages created with the filesystem routing API.In one of my use-cases, we have some pages in our CMS that need to be kept around to maintain child pages URL hierarchy. For example, we want to keep
/news-events/all-events/some-event-page
which gets it's URL from it's parent->child relationship, however we want to redirect/news-events -> /news-events/all-events
however, we get the issue:I know that we can query
allWpPage
ingatsby-node.ts
and loop over the results and then use thecreatePage
API with some logic to check for matchingfromPath
s in ourredirects.json
file and create only the non-redirected pages that way. However, the filesystem routing API is more concise and easier to reason about for others coming onto the project.It would be great if we could add logic to the
config
export, similar to how you conditionally add DSG for filesystem pages such as:The new optional
skip
property which defaults to false would cause Gatsby to not create a page for this URI at all.Beta Was this translation helpful? Give feedback.
All reactions