---
canonical: https://amplience.com/developers/docs/schema-reference/schema-examples/hierarchies/ingredients-hierarchy/
title: Ingredients hierarchy example
description: This ingredients hierarchy example is used on the Using hierarchies page. The hierarchy of ingredients is used to tag recipes created using the recipe schema.
audience: Developer
image: https://cdn.media.amplience.net/i/ampproduct/tag-example-1?w=1200&h=630
image_width: 1200
image_height: 630
date_published: 2022-07-01
date_modified: 2023-08-23
---

# Ingredients hierarchy example

This is an example hierarchy used on the [Using hierarchies](https://amplience.com/developers/docs/dev-tools/guides-tutorials/hierarchies) page. The hierarchy of ingredients is used to tag recipes created using the recipe schema which is also included on this page.

## 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 will need to register both the ingredients hierarchy schema and the recipe schema because the recipe schema links to content created from the ingredients hierarchy.

## Ingredients list hierarchy

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

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schema-examples.com/ingredients-list",
  "$comment": "Docs: https://amplience.com/docs/development/schema-examples/hierarchies/ingredients-list-hierarchy.html",
  "title": "Ingredients list",
  "description": "The ingredients list hierarchy used to tag recipe content",
  "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/ingredients-list"]
  },
  "type": "object",
  "properties": {
    "ingredient": {
      "title": "Ingredient",
      "description": "Name of ingredient",
      "type": "string",
      "minLength": 0,
      "maxLength": 200
    },
    "image": {
      "title": "image",
      "allOf": [
        {
          "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link"
        }
      ]
    },
    "hidden": {
      "title": "hidden",
      "description": "Choose to hide this ingredient",
      "type": "boolean"
    }
  },
  "propertyOrder": ["ingredient", "image"]
}
```

## Recipe schema

This is the recipe schema. Content created from this schema can be tagged with items from the ingredients hierarchy. The `ingredients` property is an array of links to content created from the ingredients list.

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schema-examples.com/recipe",
  "$comment": "Docs: https://amplience.com/docs/development/schema-examples/hierarchies/ingredients-list-hierarchy.html#recipe",
  "title": "Recipe",
  "description": "A recipe which can be tagged with ingredients from the ingredients hierarchy",
  "allOf": [
    {
      "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content"
    }
  ],
  "type": "object",
  "properties": {
    "recipeTitle": {
      "title": "Recipe title",
      "description": "The title of the recipe",
      "type": "string",
      "minLength": 0,
      "maxLength": 200
    },
    "image": {
      "title": "image",
      "allOf": [
        {
          "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link"
        }
      ]
    },
    "instructions": {
      "title": "Instructions",
      "description": "Cooking instructions",
      "type": "string",
      "format": "markdown",
      "minLength": 0,
      "maxLength": 2000
    },
    "ingredients": {
      "title": "ingredients",
      "type": "array",
      "minItems": 0,
      "maxItems": 10,
      "items": {
        "allOf": [
          {
            "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link"
          },
          {
            "properties": {
              "contentType": {
                "enum": ["https://schema-examples.com/ingredients-list"]
              }
            }
          }
        ]
      }
    }
  },
  "propertyOrder": []
}
```

## Content form preview

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

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

## Related Pages

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