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

Clarify and optimize "Adding markdown pages" docs #3512

Closed
wants to merge 1 commit into from

Conversation

adrienharnay
Copy link
Contributor

Instead of duplicating the query (once when creating the page, and once in the template), make use of context to pass the data we already have.

@gatsbybot
Copy link
Collaborator

Deploy preview for gatsbygram ready!

Built with commit 5559794

https://deploy-preview-3512--gatsbygram.netlify.com

@KyleAMathews
Copy link
Contributor

Hey! Thanks for the PR! This isn't actually a pattern we encourage. It's better to have the query in the component as then the component is self-contained & self-documented & easy to modify if e.g. you want to add/remove a field.

Agree that the duplication isn't needed — could you instead remove all the unnecessary fields in gatsby-node.js?

@adrienharnay
Copy link
Contributor Author

Oh ok, I understand. This one should maybe get updated then because it uses the opposite pattern. I will open a PR to remove the unused fields in gatsby-node.js!

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.

3 participants