0

Am trying to order the list of entries using contentful metalsmith example shown at https://github.com/contentful-labs/contentful-metalsmith-example/blob/master/build.js

Metalsmith(__dirname)
.source('src')
.destination('build')
.use(contentful({
space_id: 'w7sdyslol3fu',
access_token: 
'baa905fc9cbfab17b1bc0b556a7e17a3e783a2068c9fd6ccf74ba09331357182',
common: {
  featured_author: {
    limit: 1,
    filter: {
      'sys.id[in]': '5JQ715oDQW68k8EiEuKOk8'
    }
  }
 },
}))

I want the list of entries or post to be ordered based on their update or createdAt fields value.

Please help me out. Thanks.

antzshrek
  • 9,276
  • 5
  • 26
  • 43
user769535
  • 11
  • 3

1 Answers1

1

You can order the entries by adding the order property to the query.

https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/order/query-entries/console/js

This can be done in the global configuration or as described in the docs in the source file configuration.

https://github.com/contentful/contentful-metalsmith/blob/master/docs/source-file-settings.md#order-optional

Hope that helps. :)

stefan judis
  • 3,416
  • 14
  • 22