I'm displaying a list of tags in Gatsby using this query:
query={graphql`
query {
tags: allMarkdownRemark {
group(field: frontmatter___tags) {
fieldValue
totalCount
}
}
}
`}
At the moment it includes all the tags ever used. I want to limit the list to the top 10 most popular tags. In order to do this I need to sort them first by totalCount. How can I accomplish this?