Skip to content
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

Conversation

jbranchaud
Copy link
Contributor

closes #8841

@jbranchaud jbranchaud requested a review from a team October 12, 2018 20:05
@jbranchaud
Copy link
Contributor Author

This is still a work-in-progress, but I wanted to show that it is being worked on.

@jbranchaud jbranchaud force-pushed the add-guide-for-programmatically-creating-pages branch from 7651ce3 to fdb608c Compare October 12, 2018 21:05
@jbranchaud
Copy link
Contributor Author

It is now ready for review/feedback.

@jbranchaud jbranchaud changed the title WIP - Add guide for programmatically creating pages Add guide for programmatically creating pages Oct 12, 2018
@pieh
Copy link
Contributor

pieh commented Oct 15, 2018

@jlengstorf do we want to mention (and show) how to create pages using "unstructured data" here? Or would it be completely separate?

Copy link
Contributor

@pieh pieh left a 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`
Copy link
Contributor

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
Copy link
Contributor

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

@amberleyromo
Copy link
Contributor

@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/

@amberleyromo
Copy link
Contributor

Hi @jbranchaud! Following up -- want to make these edits?

@jbranchaud
Copy link
Contributor Author

@amberleyromo Thanks for the followup! I've made the edits. Let me know how it looks.

@jbranchaud
Copy link
Contributor Author

@pieh @amberleyromo how does this PR look? Are there any other edits needed?

Copy link
Contributor

@amberleyromo amberleyromo left a 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! 🙏🏼

@jbranchaud jbranchaud requested a review from a team as a code owner November 9, 2018 19:55
@amberleyromo amberleyromo merged commit 9b7dc7c into gatsbyjs:master Nov 9, 2018
@gatsbot
Copy link

gatsbot bot commented Nov 9, 2018

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:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

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!

gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
* Add guide for programmatically creating pages

closes gatsbyjs#8841

* Add an Other Resources section

* Address comments from review (@pieh)

* activate docs sidebar link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content migration - fill out "Programmatically create pages from data" stub article in the docs
3 participants