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

[1.0] Add to pages docs on debugging #1268

Merged
merged 1 commit into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/docs/creating-and-modifying-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ Pages can be created in three ways:
You can also implement the API [`onCreatePage`](/docs/node-apis/#onCreatePage) to
modify pages created in core or plugins or to create client-only pages.

## Debugging help

To see what pages are being created by your code or plugins, you can query
for page information while developing in Graph*i*QL. Paste the following
query in the Graph*i*QL IDE for your site.

```graphql
{
allSitePage {
edges {
node {
path
component
}
}
}
}
```

You can also query for any `context` data you or plugins added to pages.

## Creating pages in gatsby-node.js

Often you will need to programmatically create pages. For example, you have
Expand Down
5 changes: 5 additions & 0 deletions packages/gatsby/src/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ data
await writePages()
console.timeEnd(`write out pages modules`)

// Update Schema for SitePage.
console.time(`Updating schema`)
await require(`../schema`)()
console.timeEnd(`Updating schema`)

const checkJobsDone = _.debounce(resolve => {
const state = store.getState()
if (state.jobs.active.length === 0) {
Expand Down