Skip to content

Commit 7fe7bb4

Browse files
author
Bryce Flory
committed
clean up
1 parent 55c96d9 commit 7fe7bb4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

create/createCategories.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const GET_CATEGORIES = `
1919
name
2020
categoryId
2121
slug
22-
posts {
22+
posts(first:100) {
2323
nodes {
2424
...PostPreviewFragment
2525
}
@@ -35,6 +35,7 @@ const allCategories = []
3535
module.exports = async ({ actions, graphql }) => {
3636

3737
const { createPage } = actions
38+
3839
const fetchCategories = async variables =>
3940
await graphql(GET_CATEGORIES, variables).then(({ data }) => {
4041
const {
@@ -45,18 +46,23 @@ module.exports = async ({ actions, graphql }) => {
4546
},
4647
},
4748
} = data
49+
4850
nodes.map(category => {
4951
allCategories.push(category)
5052
})
53+
5154
if (hasNextPage) {
5255
return fetchCategories({ first: 100, after: endCursor })
5356
}
57+
5458
return allCategories
5559
})
5660

5761
await fetchCategories({ first: 100, after: null }).then(allCategories => {
5862
allCategories.map(category => {
63+
5964
console.log(`create category: ${category.slug}`)
65+
6066
createPage({
6167
path: `/category/${category.slug}`,
6268
component: categoryTemplate,

0 commit comments

Comments
 (0)