Skip to content

Instantly share code, notes, and snippets.

@rubenRP
Created April 27, 2020 07:27
Show Gist options
  • Save rubenRP/942db4b358126c608eeff2e54924eddc to your computer and use it in GitHub Desktop.
Save rubenRP/942db4b358126c608eeff2e54924eddc to your computer and use it in GitHub Desktop.
exports.createPages = async ({ graphql, actions, reporter }) => {
const { createPage } = actions
const blogPost = path.resolve(`./src/templates/blog-post.js`)
const defaultPage = path.resolve(`./src/templates/page.js`)
const blogPage = path.resolve(`./src/templates/blog-list.js`)
const tabPage = path.resolve(`./src/templates/tag.js`)
const categoryPage = path.resolve(`./src/templates/category.js`)
const result = await graphql(
`
{
pagesGroup: allMdx(
sort: { fields: [frontmatter___date], order: DESC }
limit: 1000
filter: { frontmatter: { published: { ne: false } } }
) {
edges {
node {
fields {
slug
}
fileAbsolutePath
frontmatter {
title
}
}
}
}
tagsGroup: allMdx(limit: 2000) {
group(field: frontmatter___taxonomy___tag) {
fieldValue
}
}
categoriesGroup: allMdx(limit: 2000) {
group(field: frontmatter___taxonomy___category) {
fieldValue
}
}
}
`
)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment