Skip to content

Commit 17a0d52

Browse files
chore(docs): Add required path import to modifying-pages doc (#27883)
Co-authored-by: Lennart <[email protected]>
1 parent 7eb5111 commit 17a0d52

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/docs/creating-and-modifying-pages.md

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ This example assumes that each markdown page has a `path` set in the frontmatter
5454
of the markdown file.
5555

5656
```javascript:title=gatsby-node.js
57+
const path = require("path")
58+
5759
// Implement the Gatsby API “createPages”. This is called once the
5860
// data layer is bootstrapped to let plugins create pages from data.
5961
exports.createPages = async ({ graphql, actions, reporter }) => {
@@ -120,6 +122,7 @@ In the initial approach you have seen how the `gatsby-node.js` file would have a
120122
Using the `id` as an access point to query for other properties in the template is the default approach. However, suppose you had a list of products with properties you would like to query for. Handling the query entirely from `gatsby-node.js` would result in the query looking like this:
121123

122124
```javascript:title=gatsby-node.js
125+
const path = require("path")
123126

124127
exports.createPages = async ({ graphql, actions }) => {
125128
const { createPage } = actions;

0 commit comments

Comments
 (0)