How to order a linked collection with the Contentful GraphQL API

Viewed 433

For the blog I'm working on I have a category page that lists all blogposts that are tagged with that category. Now I want to order those blogs by the createdAt date but I can't seem to find a solution how to order a linked collection with the Contentful GraphQL API.

The query currently looks like this:

query {
  categoryCollection(limit: 1, where: {slug: "aws"}) {
    items {
      linkedFrom {
        postCollection(limit: 6, skip: 0) {
          total
          items {
            title
            content
            createdAt
          }
        }
      }
    }
  }
}

I can use the order parameter for the categoryCollection but not for the postCollection. Is there anything I'm missing with the GraphQL API or do I need to change my content model in Contentful to make this work?

0 Answers
Related