Skip to main content
A schema for generating a breadcrumb navigation. This schema can be used in other schemas using the reference type, as you can see in the code below.
/** @type {Enterspeed.FullSchema} */
export default {
  triggers: function(context) {
    context.triggers("cms", ["homePage", "contentPage"]);
  },
  properties: function (sourceEntity, context) {
    return {
      link: {
        name: sourceEntity.properties.metaData.name,
        url: sourceEntity.url,
        originId: sourceEntity.originId,
      },
      level: sourceEntity.properties.metaData.level,
    };
  }
}
How the breadcrumb item schema will be used in a page schema.
/** @type {Enterspeed.FullSchema} */
export default {
  triggers: function(context) {
    context.triggers("cms", ["contentPage"]);
  },
  properties: function (sourceEntity, context) {
    return {
      breadcrumbs: context
                    .reference("breadcrumbItem")
                    // The nodePath property is an array of ancestor ids.
                    .byOriginIds(sourceEntity.properties.metaData.nodePath)
    };
  }
}