You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SiteNavigationElement的JSON-LD子页面itemListElement属性验证警告问题

问题背景

编写SiteNavigationElement类型的JSON-LD导航代码时,单层级结构可正常通过Schema验证,但添加子页面后出现5条警告,验证器提示:"itemListElement属性未被schema(如schema.org)识别为SiteNavigationElement对象的一部分"。

错误原因

  1. 属性类型不匹配:SiteNavigationElement本身不支持itemListElement属性,该属性属于ItemList类型,直接在导航项中嵌套子菜单不符合Schema规范。
  2. 多余数组嵌套:根节点的mainEntity被包裹了两层数组([[...]]),单层数组即可满足要求。
  3. 重复声明上下文:子节点重复添加@context,整个JSON-LD仅需在根节点声明一次@context。

修正方案

实现多级导航的正确方式是:

  • 对包含子菜单的父导航项,用ItemList类型包裹子元素,通过hasPart属性建立关联。
  • 移除多余的数组嵌套和重复的@context声明。

修正后的代码示例

<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",
            "hasPart": {
                "@type": "ItemList",
                "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",
            "hasPart": {
                "@type": "ItemList",
                "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",
            "position": 6,
            "name": "Who are we and what we are good at",
            "description": "TEMP DESCRIPTION",
            "hasPart": {
                "@type": "ItemList",
                "itemListElement": [
                    {
                        "@type": "SiteNavigationElement",
                        "position": 1,
                        "name": "Alle diensten",
                        "description": "TEMP DESCRIPTION",
                        "url": "https://example.com/who-are-we/all-services"
                    }
                ]
            }
        },
        {
            "@type": "SiteNavigationElement",
            "position": 7,
            "name": "A very simple explanation about everthing",
            "description": "TEMP DESCRIPTION",
            "url": "https://example.com/a-simple-explanation"
        },
        {
            "@type": "SiteNavigationElement",
            "position": 8,
            "name": "Nikola",
            "description": "TEMP DESCRIPTION",
            "url": "https://example.com/nikola"
        },
        {
            "@type": "SiteNavigationElement",
            "position": 9,
            "name": "Contact",
            "description": "TEMP DESCRIPTION",
            "url": "https://example.com/testcontact"
        },
        {
            "@type": "SiteNavigationElement",
            "position": 10,
            "name": "Our projects",
            "description": "TEMP DESCRIPTION",
            "url": "https://example.com/our-projects"
        },
        {
            "@type": "SiteNavigationElement",
            "position": 11,
            "name": "sddsds",
            "description": "TEMP DESCRIPTION",
            "url": "https://example.com/this-works-great"
        },
        {
            "@type": "SiteNavigationElement",
            "position": 12,
            "name": "Building your house",
            "description": "TEMP DESCRIPTION",
            "url": "https://example.com/building-your-house"
        },
        {
            "@type": "SiteNavigationElement",
            "position": 13,
            "name": "By bike",
            "description": "TEMP DESCRIPTION",
            "url": "https://example.com/bike"
        }
    ]
}
</script>

内容的提问来源于stack exchange,提问作者Alex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 05:55:53