Gatsby Category Count
19 Dec 2020 in TIL
Whilst rebuilding this blog I wanted to recategorise all of the existing posts. Before doing so, I wanted to see what all of my existing categories were and how many posts I had in each category.
Using graphql
and the GraphQL explorer I could run a query to group by frontmatter___category
and return the total count
graphql
{allMarkdownRemark {group(field: frontmatter___category) {fieldValuetotalCount}}}