【问题标题】:JSON-LD: Is the name of the value necessary?JSON-LD:值的名称是否必要?
【发布时间】:2017-07-22 09:26:39
【问题描述】:

我目前正在/about-page 中添加网络应用程序 的结构化数据。我想在那里添加一个属性。在下面的代码中,我同时使用了namevalue(正如我在schema.org 中看到的那样)。

问:我是否必须只使用value 而不使用name,并将例如Modularity 设置为value 并删除描述?

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "product",
"name":"Product_name",
"additionalProperty":
    {
    "@type":"propertyValue",
    "name":"Main features",
    "value":
        [
            {
            "@type":"propertyValue",
            "name": "Detailed documentation",
            "value": "description_of_the_documentation"
            },  
            {
            "@type":"propertyValue",
            "name": "Fully responsive",
            "value": "description_of_the_responsiveness"
            }
        ],

    "@type":"propertyValue",
    "name":"Other features",
    "value":
        [
            {
            "@type":"propertyValue",
            "name": "Modularity",
            "value": "description_of_the_modularity"
            },  
            {
            "@type":"propertyValue",
            "name": "Frequent updates",
            "value": "description_of_the_updates"
            }
        ]
    }
}
</script>

【问题讨论】:

  • (1) 请注意,Schema.org 类型区分大小写。所以你必须使用PropertyValue 而不是propertyValue 等。(2)你必须使用数组来存储additionalProperty 值。
  • (1) 是的,但是如果您使用的是 JSON-LD,则可以将第一个字母不要大写。
  • 是什么让你这么想?如果使用"@type":"propertyValue",则术语URI 为http://schema.org/propertyValue,与http://schema.org/PropertyValue 不同(后者是有效的Schema.org 类型,前者不是)。
  • 我在 Google 结构化数据测试工具上对此进行了测试,没有任何错误。你认为有可能,谷歌没有将区分大小写作为错误报告,但实际上它是?同样在搜索控制台中,也不会报错。
  • 我明白了 - Google 的 SDTT 似乎忽略了 Schema.org 的此类错误。但这当然不能使它有效。它也不适用于谷歌以外的其他消费者。很容易理解为什么大小写很重要:在创建自己的词汇表时,您可以定义两种表示不同事物的类型,它们的名称只是大小写不同。消费者必须区分,否则他们会错误地解释数据。 -- 对于 Schema.org,类型总是以大写字母开头(属性以小写字母开头),因此 SDTT 可以根据需要忽略错误,但我不会依赖它。

标签: json schema.org json-ld structured-data


【解决方案1】:

您可以为value 属性使用Boolean 值。

{
  "@type": "PropertyValue",
  "name": "Modularity",
  "value": true
}

如果要描述该功能,请另外使用description 属性。

【讨论】:

    猜你喜欢
    • 2015-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-11
    相关资源
    最近更新 更多