如何使用NPM Content Fiffly Integration与Metalsmith订购条目列表



正在尝试使用https://github.com/contentful-labs/contentful-metalsmith-metalsmith-example/blob/blob/master/build/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'
    }
  }
 },
}))

我希望根据其updatecreatedAt字段值订购条目或发布列表。

请帮助我。谢谢。

您可以通过将order属性添加到查询中来订购条目。

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

这可以在全局配置中或如源文件配置中的文档中所述完成。

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

希望有帮助。:)

最新更新