Skip to main content
A schema for listing the 3 latest news articles with a filter for global news category.
/** @type {Enterspeed.FullSchema} */
export default {
  triggers: function(context) {
    context.triggers("cms", ["frontPage"]);
  },
  routes: function(sourceEntity, context) {
    context.url(sourceEntity.url);
  },
  properties: function (sourceEntity, context) {
    return {
      title: sourceEntity.properties.name,
      description: sourceEntity.properties.description,
      latestNews: context
                .reference("news")
                .filter("type eq 'news' and properties.category eq 'globalNews'")
                .orderBy({propertyName: "properties.date", direction: "desc"})
                .limit(3)
    };
  }
}