Reputation: 3903
I want to sort my .md
files based on a frontmatter
-field, in this case "id", but for some reason I don't know it is not working.
allMarkdownRemark(
sort: {fields: frontmatter___id, order: ASC}
filter: {fileAbsolutePath: {regex: "/(cars)/.*\\.md$/"}}
) {
edges {
node {
frontmatter {
id
fabrication
engine
type
}
}
}
}
When I run this with the graphiql
-query tool, it works, but in my application it does not work and I get the error In field "fields": Expected type "MarkdownRemarkConnectionSortByFieldsEnum", found "frontmatter___id".
Can someone tell me what is wrong?
Upvotes: 2
Views: 959
Reputation: 3903
I solved it myself.
wrapping []
around did the trick: so it is:
sort: {fields: [frontmatter___id], order: ASC}
Upvotes: 3