Skip to main content

Site menu hierarchy example

This is an example hierarchy used on the using hierarchies page. This simple hierarchy is used to model a site navigation menu.

Pre-requisites
Link copied!

See the using the content type schema examples page for details of how to choose and register these schemas from the schema examples in Dynamic Content.

How to use
Link copied!

This is a self contained schema, you will just need to register the site menu hierarchy and use it to create content.

This is the site menu hierarchy schema. Note that in the childContentTypes array in the hierarchy trait, only includes the site menu type itself, so this is the only type of content that can be added to the hierarchy.

The trait:sortable object includes a default sort path that specifies that the title property will be used to sort the hierarchy nodes. They will be displayed in ascending order by title.

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schema-examples.com/site-menu-item",
"$comment": "Docs: https://amplience.com/docs/development/schema-examples/hierarchies/site-menu-hierarchy.html",
"title": "Site menu hierarchy",
"description": "A simple hierarchy used to model site navigation",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content"
},
{
"$ref": "http://bigcontent.io/cms/schema/v2/hierarchy#/definitions/hierarchy-node"
}
],
"trait:hierarchy": {
"childContentTypes": ["https://schema-examples.com/site-menu-item"]
},
"trait:sortable": {
"sortBy": [
{
"key": "default",
"paths": ["/title"]
}
]
},
"type": "object",
"properties": {
"title": {
"title": "Title",
"description": "Title used for the menu item",
"type": "string",
"minLength": 0,
"maxLength": 100
},
"description": {
"title": "Description",
"description": "description",
"type": "string",
"minLength": 0,
"maxLength": 100
}
},
"propertyOrder": [],
"required": ["title"]
}

Content form preview
Link copied!

An example of creating a content item using a content type registered from the site menu hierarchy example schema is shown in the image below.

The site menu hierarchy

Using hierarchies