Search code examples
warningsschema.orgjson-ld

JSON-LD SiteNavigationElement : itemListElement property was not recognized by the schema for subpages


I have a question, I am trying to make a JSON-LD code for my webpage using the "SiteNavigationElement" type scheme.

However when I try to validate it. It gets rejected with 5 warnings. This is curious to me. Because as soon as I have a one level JSON-LD code without sub-pages it validates fine.

But when I add sub-pages it generates a warning.

Translated from Polish the validator says :

The itemListElement property was not recognized by the schema (e.g. schema.org) as part of a SiteNavigationElement object.

enter image description here

And I have no idea how to solve this.

<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "SiteNavigationElement",
    "name": "Top Level Navigation",
    "mainEntity": [
        [
            {
                "@type": "SiteNavigationElement",
                "position": 1,
                "name": "home",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 2,
                "name": "A very nice page",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/about-the-page"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 3,
                "name": "diensten",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/all-services"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 4,
                "name": "contact",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/contact",
                "@context": "https://schema.org",
                "itemListElement": [
                    {
                        "@type": "SiteNavigationElement",
                        "position": 1,
                        "name": "Den Haag",
                        "description": "TEMP DESCRIPTION",
                        "url": "https://example.com/contact/den-haag"
                    },
                    {
                        "@type": "SiteNavigationElement",
                        "position": 2,
                        "name": "Haarlem",
                        "description": "TEMP DESCRIPTION",
                        "url": "https://example.com/contact/haarlem"
                    }
                ]
            },
            {
                "@type": "SiteNavigationElement",
                "position": 5,
                "name": "over ons",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/about-us",
                "@context": "https://schema.org",
                "itemListElement": [
                    {
                        "@type": "SiteNavigationElement",
                        "position": 1,
                        "name": "A very nice page",
                        "description": "TEMP DESCRIPTION",
                        "url": "https://example.com/about-the-page"
                    },
                    {
                        "@type": "SiteNavigationElement",
                        "position": 2,
                        "name": "Where we are good at",
                        "description": "TEMP DESCRIPTION",
                        "url": "https://example.com/about-us/we-are-good-at"
                    }
                ]
            },
            {
                "@type": "SiteNavigationElement",
                "name": "Who are we and what we are good at",
                "description": "TEMP DESCRIPTION",
                "@context": "https://schema.org",
                "itemListElement": [
                    {
                        "@type": "SiteNavigationElement",
                        "position": 1,
                        "name": "Alle diensten",
                        "description": "TEMP DESCRIPTION",
                        "url": "https://example.com/who-are-we/all-services"
                    }
                ]
            },
            {
                "@type": "SiteNavigationElement",
                "position": 6,
                "name": "A very simple explanation about everthing",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/a-simple-explanation"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 7,
                "name": "Nikola",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/nikola"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 8,
                "name": "Contact",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/testcontact"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 9,
                "name": "Our projects",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/our-projects"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 10,
                "name": "sddsds",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/this-works-great"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 11,
                "name": "Building your house",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/building-your-house"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 12,
                "name": "By bike",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/bike"
            }
        ]
    ]
}
</script>

It basically gives me a warning as soon as I start a sub-element. But I wonder what I am doing wrong there?

    {
        "@type": "SiteNavigationElement",
        "position": 4,
        "name": "contact",
        "description": "TEMP DESCRIPTION",
        "url": "https://example.com/contact",
        "@context": "https://schema.org",
        "itemListElement": [
            {
                "@type": "SiteNavigationElement",
                "position": 1,
                "name": "Den Haag",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/contact/den-haag"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 2,
                "name": "Haarlem",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/contact/haarlem"
            }
        ]
    },

I did start the position a new. I set the context again. But again... Without children / sub-pages it works great.

Working example without subpages and no warnings

<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "SiteNavigationElement",
    "name": "Top Level Navigation",
    "mainEntity": [
        [
            {
                "@type": "SiteNavigationElement",
                "position": 1,
                "name": "home",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 2,
                "name": "A very nice page",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/about-the-page"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 3,
                "name": "diensten",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/all-services"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 4,
                "name": "A test page x 0",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/test-page-x-0"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 5,
                "name": "A test page x",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/test-page-x"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 6,
                "name": "A very simple explanation about everthing",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/a-simple-explanation"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 7,
                "name": "Nikola",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/nikola"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 8,
                "name": "Contact",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/testcontact"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 9,
                "name": "Our projects",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/our-projects"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 10,
                "name": "sddsds",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/this-works-great"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 11,
                "name": "Building your house",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/building-your-house"
            },
            {
                "@type": "SiteNavigationElement",
                "position": 12,
                "name": "By bike",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/bike"
            }
        ]
    ]
}
</script>


Solution

  • As pointed out, your markup uses SiteNavigationElement entity, which doesn't have itemListElement property, as defined in the Schema.org (it can be used with ItemList).

    It seems you're trying to construct multiple SiteNavigationElement entities in a child-parent relation.

    There are a few ways to do it.

    You could replace itemListElement property with hasPart, which would then express child-parent relation, and pass the validation.

                "@type": "SiteNavigationElement",
                "position": 4,
                "name": "contact",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/contact",
                "@context": "https://schema.org",
                "hasPart": [
                    {
                        "@type": "SiteNavigationElement",
                        "position": 1,
                        
    

    full code that passes validation:

    <script type="application/ld+json">
      {
        "@context": "https://schema.org",
        "@type": "SiteNavigationElement",
        "name": "Top Level Navigation",
        "mainEntity": [
          [{
              "@type": "SiteNavigationElement",
              "position": 1,
              "name": "home",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 2,
              "name": "A very nice page",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/about-the-page"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 3,
              "name": "diensten",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/all-services"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 4,
              "name": "contact",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/contact",
              "@context": "https://schema.org",
              "hasPart": [{
                  "@type": "SiteNavigationElement",
                  "position": 1,
                  "name": "Den Haag",
                  "description": "TEMP DESCRIPTION",
                  "url": "https://example.com/contact/den-haag"
                },
                {
                  "@type": "SiteNavigationElement",
                  "position": 2,
                  "name": "Haarlem",
                  "description": "TEMP DESCRIPTION",
                  "url": "https://example.com/contact/haarlem"
                }
              ]
            },
            {
              "@type": "SiteNavigationElement",
              "position": 5,
              "name": "over ons",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/about-us",
              "@context": "https://schema.org",
              "hasPart": [{
                  "@type": "SiteNavigationElement",
                  "position": 1,
                  "name": "A very nice page",
                  "description": "TEMP DESCRIPTION",
                  "url": "https://example.com/about-the-page"
                },
                {
                  "@type": "SiteNavigationElement",
                  "position": 2,
                  "name": "Where we are good at",
                  "description": "TEMP DESCRIPTION",
                  "url": "https://example.com/about-us/we-are-good-at"
                }
              ]
            },
            {
              "@type": "SiteNavigationElement",
              "name": "Who are we and what we are good at",
              "description": "TEMP DESCRIPTION",
              "@context": "https://schema.org",
              "hasPart": [{
                "@type": "SiteNavigationElement",
                "position": 1,
                "name": "Alle diensten",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/who-are-we/all-services"
              }]
            },
            {
              "@type": "SiteNavigationElement",
              "position": 6,
              "name": "A very simple explanation about everthing",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/a-simple-explanation"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 7,
              "name": "Nikola",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/nikola"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 8,
              "name": "Contact",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/testcontact"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 9,
              "name": "Our projects",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/our-projects"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 10,
              "name": "sddsds",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/this-works-great"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 11,
              "name": "Building your house",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/building-your-house"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 12,
              "name": "By bike",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/bike"
            }
          ]
        ]
      }
    </script>

    Also, as itemListElement property belongs to ItemList entity, you might simply add it to the SiteNavigationElement, which would semantically mean it's both entities, and allow you to mix properties of both entities at once:

                "@type": ["SiteNavigationElement", "ItemList"],
                "position": 4,
                "name": "contact",
    

    full code that passes validation:

    <script type="application/ld+json">
      {
        "@context": "https://schema.org",
        "@type": "SiteNavigationElement",
        "name": "Top Level Navigation",
        "mainEntity": [
          [{
              "@type": "SiteNavigationElement",
              "position": 1,
              "name": "home",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 2,
              "name": "A very nice page",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/about-the-page"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 3,
              "name": "diensten",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/all-services"
            },
    
            {
              "@type": ["SiteNavigationElement", "ItemList"],
              "position": 4,
              "name": "contact",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/contact",
              "@context": "https://schema.org",
              "itemListElement": [{
                  "@type": "SiteNavigationElement",
                  "position": 1,
                  "name": "Den Haag",
                  "description": "TEMP DESCRIPTION",
                  "url": "https://example.com/contact/den-haag"
                },
                {
                  "@type": "SiteNavigationElement",
                  "position": 2,
                  "name": "Haarlem",
                  "description": "TEMP DESCRIPTION",
                  "url": "https://example.com/contact/haarlem"
                }
              ]
            },
            {
              "@type": ["SiteNavigationElement", "ItemList"],
              "position": 5,
              "name": "over ons",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/about-us",
              "@context": "https://schema.org",
              "itemListElement": [{
                  "@type": "SiteNavigationElement",
                  "position": 1,
                  "name": "A very nice page",
                  "description": "TEMP DESCRIPTION",
                  "url": "https://example.com/about-the-page"
                },
                {
                  "@type": "SiteNavigationElement",
                  "position": 2,
                  "name": "Where we are good at",
                  "description": "TEMP DESCRIPTION",
                  "url": "https://example.com/about-us/we-are-good-at"
                }
              ]
            },
            {
              "@type": ["SiteNavigationElement", "ItemList"],
              "name": "Who are we and what we are good at",
              "description": "TEMP DESCRIPTION",
              "@context": "https://schema.org",
              "itemListElement": [{
                "@type": "SiteNavigationElement",
                "position": 1,
                "name": "Alle diensten",
                "description": "TEMP DESCRIPTION",
                "url": "https://example.com/who-are-we/all-services"
              }]
            },
            {
              "@type": "SiteNavigationElement",
              "position": 6,
              "name": "A very simple explanation about everthing",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/a-simple-explanation"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 7,
              "name": "Nikola",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/nikola"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 8,
              "name": "Contact",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/testcontact"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 9,
              "name": "Our projects",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/our-projects"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 10,
              "name": "sddsds",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/this-works-great"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 11,
              "name": "Building your house",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/building-your-house"
            },
            {
              "@type": "SiteNavigationElement",
              "position": 12,
              "name": "By bike",
              "description": "TEMP DESCRIPTION",
              "url": "https://example.com/bike"
            }
          ]
        ]
      }
    </script>

    and it would also blur the line between the two entities, so I'd use the former approach.

    Depending on what you're using structured data for, you might also consider using BreadcrumbList (it seems there is no mention of child-parent relations, you just create a list of pages, and hasPart property cannot be used with that entity...)