Created
April 27, 2020 07:27
-
-
Save rubenRP/942db4b358126c608eeff2e54924eddc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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