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 is set up to support the hierarchy drag and drop feature. Users will be able to drag hierarchy nodes to anywhere within the hierarchy.

{
"$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. Supports hierarchy drag and drop.",
"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": [
"/_meta/hierarchy/position"
]
}
]
},
"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
},
"_meta": {
"type": "object",
"properties": {
"deliveryKey": {
"type": "string",
"title": "Delivery key",
"description": "The delivery key is used as the URL slug"
}
}
}
},
"propertyOrder": []
}

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