我正在尝试使用 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'
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我希望为常见问题解答模式添加另一个模式。我根本不明白这是如何工作的。你能帮助我吗?
我刚刚收到插件作者的回复。解决方案是使用@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"
}
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
686 次 |
| 最近记录: |