Skip to content

Commit

Permalink
Update URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamyonk committed Oct 17, 2019
1 parent a39d91d commit f60600e
Show file tree
Hide file tree
Showing 31 changed files with 272 additions and 163 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Project dependencies
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
.cache/
# Build directory
public/
.DS_Store
yarn-error.log
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
author: "Adam Jahnke",
},
plugins: [
{ resolve: "gatsby-plugin-typescript" },
{ resolve: "@rhysforyou/gatsby-plugin-react-helmet-async" },
{ resolve: "gatsby-plugin-styled-jsx" },
{
Expand Down
42 changes: 21 additions & 21 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,32 @@ exports.createPages = ({ actions, graphql }) => {
}
}
}
tags: allMarkdownRemark {
group(field: frontmatter___tags) {
fieldValue
totalCount
}
}
}
`).then(({ errors, data }) => {
if (errors) {
return Promise.reject(errors)
}

// Generate tag index pages
data.pages.edges
// Loop through all the posts and gather unique tags
.reduce((a, { node: { frontmatter: { tags } } }) => {
if (!tags) {
return a
}
for (const tag of tags) {
a.add(tag)
}
return a
}, new Set())
// Create an index for each tag
.forEach(tag => {
createPage({
path: `/tags/${tag}`,
component: path.resolve(`src/templates/tag.js`),
context: { tag },
})
})
// Create an index page for each individual tag
data.tags.group.forEach(({ fieldValue: tag }) => {
createPage({
path: `/tags/${tag}`,
component: path.resolve(`src/templates/tag.tsx`),
context: { tag }
});
});
createPage({
path: `/tags`,
component: path.resolve(`src/templates/tags.tsx`),
context: { tags: data.tags.group }
});

// Generate all pages
data.pages.edges.forEach(
Expand All @@ -66,7 +66,7 @@ exports.createPages = ({ actions, graphql }) => {
createPage({
path: formatPath(fileAbsolutePath),
component: path.resolve(
`src/templates/${String(templateKey || "page")}.js`,
`src/templates/${String(templateKey || "page")}.tsx`,
),
context: { id }, // additional data can be passed via context
})
Expand Down
3 changes: 0 additions & 3 deletions netlify.toml

This file was deleted.

82 changes: 63 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"gatsby-plugin-remove-serviceworker": "^1.0.0",
"gatsby-plugin-sharp": "^2.2.29",
"gatsby-plugin-styled-jsx": "^3.1.10",
"gatsby-plugin-typescript": "^2.1.15",
"gatsby-remark-images": "^3.1.26",
"gatsby-remark-prismjs": "^3.3.18",
"gatsby-source-filesystem": "^2.1.31",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

1 comment on commit f60600e

@vercel
Copy link

@vercel vercel bot commented on f60600e Oct 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.