如何使用JSON-LD正确实现具有多个列表的Schema.org?

时间:2019-09-02 09:14:22

标签: schema.org json-ld

我正在将Schema.org结构化数据实现到我的杂志式网站中,并且对使用多个列表有一些担忧。

我的主页上有两个部分:“最新”和“最受欢迎”。两个部分均包含五个微型文章。我已经将这两个部分都视为“列表”。这是一个部分的示例-显然,其他部分与文章相同:

enter image description here

这是我的Schema JSON-LD。为了使该示例易于阅读并删除了域名/名称,我在...处将其简化了一点。到目前为止,我仅在此{{1 }},并使用Google的结构化数据测试工具对其进行测试,将返回零警告和零错误:

ItemList

但是,如上所述,本<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "ItemList", "numberOfItems": "5", "itemListOrder": "Descending", "itemListElement": [ { "@type": "Article", "position": "1", "mainEntityOfPage": { "@type": "WebPage", "@id": "/motoring/audi-launches-2019-sq8-tdi/" }, "articleSection": "Motoring", "headline": "Audi launches 2019 SQ8 TDI", "datePublished": "2019-09-01", "dateModified": "2019-09-01", "image": "/content/uploads/2019/08/2019-audi-sq8-tdi-001-800.jpg", "url": "/motoring/audi-launches-2019-sq8-tdi/", "author": "The Author", "publisher": { "@type": "Organization", "name": "Company Name", "url": "https://company.name", "logo": { "@type": "ImageObject", "url": "https://company.name/logo.png" }, "founder": "Founder", "foundingDate": "2019" } }, { "@type": "Article", "position": "2", "mainEntityOfPage": { "@type": "WebPage", "@id": "/gadgets-tech/meet-keysmart-the-smart-key-oraganiser/" }, "articleSection": "Gadgets & Tech", "headline": "Meet Keysmart: The smart key organiser", "datePublished": "2019-09-01", "dateModified": "2019-09-01", "image": "/content/uploads/2019/08/the-smartkey-orgainser-001-800.jpg", "url": "/gadgets-tech/meet-keysmart-the-smart-key-oraganiser/", "author": "The Author", "publisher": { "@type": "Organization", "name": "Company Name", "url": "https://company.name", "logo": { "@type": "ImageObject", "url": "https://company.name/logo.png" }, "founder": "Founder", "foundingDate": "2019" } }, ... ] } </script> 仅适用于五篇“最新”文章。我现在想为另一部分“最受欢迎”添加结构化数据,但不确定如何最好地使用它。

  1. 是否将最受欢迎的五篇文章添加到同一本ItemList中, 创建一个新的ItemList还是创建一个新的脚本/ JSON?怎么 这个最好的实现?请提供示例。
  2. 我真的需要为每篇文章添加发布者/组织吗? 我是否可以将其缩短?似乎不必要地笨重 像我一样做。我读过将“组织”数据添加到 每页都是不好的做法(请参见下面的链接)-在这里适用吗?
  3. 这些微型文章中的每一篇都指向使用的完整文章 ItemList。我使用类型'WebPage'是正确的还是应该 使用类型“ Article”?
  4. 如果需要两个列表,是否可以告诉搜索引擎 一个列表包含最新项目,一个包含大多数项目 受欢迎还是不必要?

https://www.searchenginejournal.com/google-do-not-put-organization-schema-markup-on-every-page/289981/

1 个答案:

答案 0 :(得分:2)

通常使用HTML5语义元素(主要,部分等)+正确的网站大纲(每个列表均使用H2等)。

两个列表

关于您的架构。 最好的想法是在“微数据”视图中进行思考。

您的列表未嵌套

<ul>
  <li>
    <ul><li></li></ul>
  </li>
  <li>
    <ul><li></li></ul>
  </li>
</ul>

嵌套列表示例: https://schema.org/OfferCatalog#offer-3

使用多个json-ld脚本

在这种情况下,我认为最好/简单的想法是使用两个单独的列表“对象” (并为每个列表添加名称/ url /等等)-示例概述(缺少短代码的属性):

<script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "ItemList",
        "name": "Recent Articles",
        "numberOfItems": "1",
        "itemListOrder": "Descending",
        "itemListElement": [
            {
                "@type": "Article",
                "position": "1",
                "headline": "I am recent Article"
            }          
        ]

    }
</script>
<script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "ItemList",
        "name": "Popular Articles",
        "numberOfItems": "1",
        "itemListOrder": "Descending",
        "itemListElement": [
            {
                "@type": "Article",
                "position": "1",
                "headline": "I am Popular Article"
            }          
        ]    
    }
</script>

enter image description here

https://webmasters.stackexchange.com/questions/96903/can-i-have-multiple-json-ld-scripts-in-the-same-page

发布者为itemref

尝试这个想法:

示例(对组织的引用组织对象):

<!-- Organization -->
<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "Organization",
    "@id": "#Organization-name",
    "name": "My Organization"
}
</script>
<!-- Recent Articles -->
<script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "ItemList",
        "name": "Recent Articles",
        "numberOfItems": "1",
        "itemListOrder": "Descending",
        "itemListElement": [
            {
                "@type": "Article",
                "position": "1",
                "headline": "I am recent Article",
                "publisher": {
                 "@id": "#Organization-name"
                 }
            }          
        ]
    }
</script>
<!-- Popular Articles -->
<script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "ItemList",
        "name": "Popular Articles",
        "numberOfItems": "1",
        "itemListOrder": "Descending",
        "itemListElement": [
            {
                "@type": "Article",
                "position": "1",
                "headline": "I am Popular Article",
                 "publisher": {
                     "@id": "#Organization-name"
                 }
            }          
        ]    
    }
</script>

测试工具输出: testing-tool

页面维护

阅读: https://webmasters.stackexchange.com/questions/87940/new-required-mainentityofpage-for-article-structured-data