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

semi-colons #3765

Merged
merged 1 commit into from
Jan 29, 2018
Merged
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
40 changes: 20 additions & 20 deletions docs/tutorial/part-four/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ module.exports = {
},
},
],
}
};
```

Restart the development server.
Expand Down Expand Up @@ -405,7 +405,7 @@ module.exports = {
},
},
],
}
};
```

Save that and restart the gatsby development server. Then open up Graph_i_QL
Expand Down Expand Up @@ -607,7 +607,7 @@ module.exports = {
},
},
],
}
};
```

Restart the development server then refresh (or open again) Graph_i_QL and look
Expand Down Expand Up @@ -769,7 +769,7 @@ exports.onCreateNode = ({ node }) => {
if (node.internal.type === `MarkdownRemark`) {
console.log(node.internal.type)
}
}
};
```

We want to use each Markdown file name to create the page slug. So
Expand All @@ -784,7 +784,7 @@ exports.onCreateNode = ({ node, getNode }) => {
const fileNode = getNode(node.parent)
console.log(`\n`, fileNode.relativePath)
}
}
};
```

There in your terminal you should see the relative paths for our two Markdown
Expand All @@ -797,13 +797,13 @@ tricky, the `gatsby-source-filesystem` plugin ships with a function for creating
slugs. Let's use that.

```javascript{1,5}
const { createFilePath } = require(`gatsby-source-filesystem`)
const { createFilePath } = require(`gatsby-source-filesystem`);

exports.onCreateNode = ({ node, getNode }) => {
if (node.internal.type === `MarkdownRemark`) {
console.log(createFilePath({ node, getNode, basePath: `pages` }))
}
}
};
```

The function handles finding the parent `File` node along with creating the
Expand All @@ -822,7 +822,7 @@ the original creator of a node can directly modify the node—all other plugins
fields.

```javascript{3,4,6-11}
const { createFilePath } = require(`gatsby-source-filesystem`)
const { createFilePath } = require(`gatsby-source-filesystem`);

exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
const { createNodeField } = boundActionCreators
Expand All @@ -834,7 +834,7 @@ exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
value: slug,
})
}
}
};
```

Restart the development server and open or refresh Graph_i_QL. Then run this
Expand All @@ -860,7 +860,7 @@ In the same `gatsby-node.js` file, add the following. Here we tell Gatsby about
our pages—what are their paths, what template component do they use, etc.

```javascript{15-34}
const { createFilePath } = require(`gatsby-source-filesystem`)
const { createFilePath } = require(`gatsby-source-filesystem`);

exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
const { createNodeField } = boundActionCreators
Expand All @@ -872,7 +872,7 @@ exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
value: slug,
})
}
}
};

exports.createPages = ({ graphql, boundActionCreators }) => {
return new Promise((resolve, reject) => {
Expand All @@ -893,7 +893,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
resolve()
})
})
}
};
```

We've added an implementation of the
Expand Down Expand Up @@ -922,8 +922,8 @@ export default () => {
Then update `gatsby-node.js`

```javascript{1,17,32-41}
const path = require(`path`)
const { createFilePath } = require(`gatsby-source-filesystem`)
const path = require(`path`);
const { createFilePath } = require(`gatsby-source-filesystem`);

exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
const { createNodeField } = boundActionCreators
Expand All @@ -935,7 +935,7 @@ exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
value: slug,
})
}
}
};

exports.createPages = ({ graphql, boundActionCreators }) => {
const { createPage } = boundActionCreators
Expand Down Expand Up @@ -966,7 +966,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
resolve()
})
})
}
};
```

Restart the development server and our pages will be created! An easy way to
Expand Down Expand Up @@ -1020,11 +1020,11 @@ Return to `src/pages/index.js` and let's query for our Markdown slugs and create
links.

```jsx{3,18-19,29,46-48}
import React from "react"
import g from "glamorous"
import Link from "gatsby-link"
import React from "react";
import g from "glamorous";
import Link from "gatsby-link";

import { rhythm } from "../utils/typography"
import { rhythm } from "../utils/typography";

export default ({ data }) => {
return (
Expand Down