Tag and category pages

This commit is contained in:
2020-09-30 17:16:27 -05:00
parent 40f5df18b5
commit 8b9d33cb44
5 changed files with 77 additions and 5 deletions

View File

@@ -33,6 +33,11 @@ exports.createPages = async ({ graphql, actions }) => {
fieldValue
}
}
categoriesGroup: allMarkdownRemark {
group(field: frontmatter___categories) {
fieldValue
}
}
}
`);
@@ -55,4 +60,14 @@ exports.createPages = async ({ graphql, actions }) => {
}
});
});
result.data.categoriesGroup.group.forEach((category) => {
createPage({
path: `/categories/${category.fieldValue}/`,
component: path.resolve(`./src/templates/category.js`),
context: {
category: category.fieldValue
}
});
});
};