---
canonical: https://amplience.com/developers/docs/schema-reference/schema-examples/hierarchies/page-hierarchy/
title: Page hierarchy example
description: This Amplience page hierarchy example uses 2 content types to implement an ideas section on a website, and could model any structure of categories and pages.
audience: Developer
image: https://cdn.media.amplience.net/i/ampproduct/page-hierarchy-example-1?w=1200&h=630
image_width: 1200
image_height: 630
date_published: 2022-07-01
date_modified: 2023-08-23
---

# Page hierarchy example

This is an example hierarchy used on the [using hierarchies](https://amplience.com/developers/docs/dev-tools/guides-tutorials/hierarchies) page. This example makes use of two content types to implement an ideas and advice section on a website, but it could be used to model any structure of categories and pages.

The page-hierarchy content type represents a category such as "Lighting and electrical" or "Heating and plumbing". It contains a title, description, image and a ranking. The page-hierarchy-node content type is the help page itself, including content such as text and images.

## Pre-requisites

See the [using the content type schema examples](https://amplience.com/developers/docs/schema-reference/schema-examples/use) page for details of how to choose and register these schemas from the schema examples in Dynamic Content.

## How to use

You need to register both the page-hierarchy and page-hierarchy-node schemas. The page-hierarchy-node schema also makes use of the example-author, example-image and example-text schemas included with the [blog post](https://amplience.com/developers/docs/schema-reference/schema-examples/blog) example, so you will need to ensure that these schemas are registered as well.

## Page hierarchy

The page hierarchy represents categories and in the `childContentTypes` array in the hierarchy trait includes page-hierarchy and page-hierarchy-node, so both these content types can be added as children of a page-hierarchy item.

In the sort trait we've specified that nodes should be sorted by a user defined ranking. If the ranking is equal, the title will be used as a sort tie breaker.

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schema-examples.com/page-hierarchy",
  "$comment": "Docs: https://amplience.com/docs/development/schema-examples/hierarchies/page-hierarchy.html",

  "title": "Page Category",
  "description": "Category that can contain pages or subcategories",
  "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/page-hierarchy",
      "https://schema-examples.com/page-hierarchy-node"
    ]
  },
  "type": "object",
  "properties": {
    "_meta": {
      "type": "object",
      "properties": {
        "deliveryKey": {
          "type": "string",
          "title": "Delivery key",
          "description": "The delivery key is used as the URL slug"
        }
      }
    },
    "title": {
      "title": "Title",
      "description": "HTML title tag",
      "type": "string",
      "minLength": 0,
      "maxLength": 100
    },
    "description": {
      "title": "Description",
      "description": "used for SEO description",
      "type": "string"
    },
    "ranking": {
      "title": "Ranking",
      "description": "used for sorting",
      "type": "number",
      "minimum": 0,
      "maximum": 100
    },
    "image": {
      "title": "Image",
      "allOf": [
        {
          "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link"
        }
      ]
    }
  },
  "propertyOrder": [],
  "required": ["title"],
  "trait:sortable": {
    "sortBy": [
      {
        "key": "default",
        "paths": ["/ranking", "/title"]
      }
    ]
  }
}
```

## Page hierarchy node

Note that for the page-hierarchy-node schema the `childContentTypes` array is empty because we don't want to add any children to page hierarchy nodes.

```json
{
  "$schema": "http://bigcontent.io/cms/schema/v2/schema#",
  "$id": "https://schema-examples.com/page-hierarchy-node",
  "$comment": "Docs: https://amplience.com/docs/development/schema-examples/hierarchies/page-hierarchy.html#hierarchy-node",
  "title": "Page",
  "description": "Page as a hierarchy node",
  "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": []
  },
  "type": "object",
  "properties": {
    "title": {
      "title": "Title",
      "description": "Used for heading and SEO title tag",
      "type": "string",
      "minLength": 1,
      "maxLength": 150
    },
    "description": {
      "title": "Description",
      "description": "Used for page summary and SEO description",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "ranking": {
      "title": "Ranking",
      "description": "used for sorting pages",
      "type": "number",
      "minimum": 0,
      "maximum": 100
    },
    "image": {
      "title": "Image",
      "description": "Used for the page banner",
      "allOf": [
        {
          "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link"
        },
        {
          "properties": {
            "contentType": {
              "enum": ["https://schema-examples.com/example-image"]
            }
          }
        }
      ]
    },
    "_meta": {
      "type": "object",
      "properties": {
        "deliveryKey": {
          "type": "string",
          "title": "Delivery key",
          "description": "The delivery key is used as the URL slug"
        }
      }
    },
    "authors": {
      "title": "Page author",
      "description": "Author(s) - max 3",
      "type": "array",
      "minItems": 1,
      "maxItems": 3,
      "items": {
        "allOf": [
          {
            "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link"
          },
          {
            "properties": {
              "contentType": {
                "enum": ["https://schema-examples.com/example-author"]
              }
            }
          }
        ]
      }
    },
    "content": {
      "title": "Content",
      "description": "",
      "type": "array",
      "minItems": 1,
      "maxItems": 20,
      "items": {
        "allOf": [
          {
            "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link"
          },
          {
            "properties": {
              "contentType": {
                "title": "Content",
                "enum": [
                  "https://schema-examples.com/example-image",
                  "https://schema-examples.com/example-text"
                ]
              }
            }
          }
        ]
      }
    }
  }
}
```

## Content form preview

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

The page-hierarchy content type (1 in the image) represents a category such as "Lighting and electrical" or "Heating and plumbing". It contains a title, description, image and a ranking. The page-hierarchy-node content type (2) is the help page itself, including content such as text and images.

![The page hierarchy example](https://cdn.media.amplience.net/i/ampproduct/page-hierarchy-example-1?w=1880&fmt=png 'The page hierarchy example')

## Related Pages

[Using hierarchies](https://amplience.com/developers/docs/dev-tools/guides-tutorials/hierarchies)

[Blog example](https://amplience.com/developers/docs/schema-reference/schema-examples/blog)
