-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add guide for programmatically creating pages #9069
Add guide for programmatically creating pages #9069
Conversation
This is still a work-in-progress, but I wanted to show that it is being worked on. |
7651ce3
to
fdb608c
Compare
It is now ready for review/feedback. |
@jlengstorf do we want to mention (and show) how to create pages using "unstructured data" here? Or would it be completely separate? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments
``` | ||
|
||
For each page we want to create we must specify the `path` for visiting that | ||
page, the `component` template used to render that page, and any `context` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe mention that context
is optional? By default gatsby will pass some context already - stuff like path
`; | ||
``` | ||
|
||
Notice that the `slug` value we specified in the `createPage` context is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also use context directly in template component - it's accessible via pageContext
prop
@pieh @jlengstorf I think we could link to the unstructured data doc at the end so people could hop over if they're interested. https://www.gatsbyjs.org/docs/using-unstructured-data/ |
Hi @jbranchaud! Following up -- want to make these edits? |
@amberleyromo Thanks for the followup! I've made the edits. Let me know how it looks. |
@pieh @amberleyromo how does this PR look? Are there any other edits needed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay -- this looks great to me. Thank you for contributing this! 🙏🏼
Holy buckets, @jbranchaud — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
* Add guide for programmatically creating pages closes gatsbyjs#8841 * Add an Other Resources section * Address comments from review (@pieh) * activate docs sidebar link
closes #8841