gpt4 book ai didi

nuxt.js - 返回多个 jsonld 模式

转载 作者:行者123 更新时间:2023-12-02 00:07:59 28 4
gpt4 key购买 nike

我正在尝试使用 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'
}
}
}

但是,我想为 FAQ 架构添加另一个架构。我根本无法弄清楚这是如何工作的。你能帮帮我吗?

最佳答案

我刚刚收到插件背后的作者的回复。解决方案是使用@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"
}
]
}

关于nuxt.js - 返回多个 jsonld 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59971960/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com