mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-01-13 23:39:32 +01:00
24 lines
529 B
JavaScript
24 lines
529 B
JavaScript
// @flow strict
|
|
import { useStaticQuery, graphql } from 'gatsby';
|
|
|
|
const useCategoriesList = () => {
|
|
const { allMarkdownRemark } = useStaticQuery(
|
|
graphql`
|
|
query CategoriesListQuery {
|
|
allMarkdownRemark(
|
|
filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
|
|
) {
|
|
group(field: frontmatter___category) {
|
|
fieldValue
|
|
totalCount
|
|
}
|
|
}
|
|
}
|
|
`
|
|
);
|
|
|
|
return allMarkdownRemark.group;
|
|
};
|
|
|
|
export default useCategoriesList;
|