Order posts by date
What you might have noticed after going headless and WordPress is that posts are are not ordered the way you would like, newer posts first ordered by date. This can be fixed by adding sort: {fields: date, order: DESC}
parameters to your query.
export const pageQuery = graphql`
query {
allWordpressPost(sort: {fields: date, order: DESC}) {
edges {
node {
title
excerpt
slug
}
}
}
}
`
For other field and order sort settings, I recommend using the GraphiQL that comes packaged with Gatsby.
Next: Add analytics
Previous: Add author to copyright
...