mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-01-15 00:01:31 +01:00
24 lines
522 B
JavaScript
24 lines
522 B
JavaScript
|
// @flow
|
||
|
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;
|