【问题标题】:Returning multiple jsonld schemas返回多个 jsonld 模式
【发布时间】:2020-01-30 01:04:29
【问题描述】:

我正在尝试使用 Nuxt.js 在一个脚本标签中返回多种结构化类型。 我正在使用这个插件:https://github.com/ymmooot/nuxt-jsonld

在我的网站https://kassebil.dk/ford-kassebil/ford-transit-custom 上,您可以看到此代码已经可以使用:

  jsonld() {
    const { brand, modelTitle, seoText, modelImage } = this.modelInfo
    const price = this.lowOffer
    return {
      '@context': 'https://schema.org',
      '@type': 'product',
      'brand': `${brand}`,
      'model': `${modelTitle}`,
      'name': `${modelTitle}`,
      'description': `${seoText.replace(/<[^>]*>?/gm, '')}`,
      'image': `https://res.cloudinary.com/kassebil/image/upload/${modelImage}`,
      'url': `https://kassebil.dk${this.$route.path}`,
      'offers': {
        '@type': 'AggregateOffer',
        'lowPrice': `${price}`,
        'priceCurrency': 'DKK'
      }
    }
  }

但是,我希望为常见问题解答模式添加另一个模式。我根本无法弄清楚这是如何工作的。你能帮帮我吗?

【问题讨论】:

    标签: nuxt.js json-ld


    【解决方案1】:

    我刚收到插件背后作者的回复。解决方案是使用@graph。

    这是一个例子:

    {
      "@context": "http://schema.org",
      "@graph":
      [
        {
          "@type": "BreadcrumbList",
          "itemListElement": [
            {
              "@type": "ListItem",
              "position": 1,
              "item": {
                "@id": "https://example.com/articles/1",
                "name": "foo"
              }
            }
          ]
        },
        {
          "@type": "NewsArticle",
          "mainEntityOfPage": {
            "@type": "WebPage",
            "@id": "https://google.com/article"
          },
          "headline": "Article headline",
          "image": [
            "https://example.com/photos/1x1/photo.jpg",
            "https://example.com/photos/4x3/photo.jpg",
            "https://example.com/photos/16x9/photo.jpg"
          ],
          "datePublished": "2015-02-05T08:00:00+08:00",
          "dateModified": "2015-02-05T09:20:00+08:00",
          "author": {
            "@type": "Person",
            "name": "John Doe"
          },
          "publisher": {
            "@type": "Organization",
            "name": "Google",
            "logo": {
              "@type": "ImageObject",
              "url": "https://google.com/logo.jpg"
            }
          },
          "description": "A most wonderful article"
        }
      ]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-22
      • 1970-01-01
      • 2015-03-14
      • 1970-01-01
      • 2012-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多