我很好奇将JSON-LD应用到schema.org网站的最佳实践.
如果我有一个页面,Article我也想WebSite在我的页面上定义,我会这样:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "http://www.example.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://www.example.com/search?&q={query}",
"query-input": "required"
}
}
</script>
<!- … -->
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"author": "John Doe",
"interactionCount": [
"UserTweets:1203",
"UserComments:78"
],
"name": "How to Tie a Reef Knot"
}
</script>
Run Code Online (Sandbox Code Playgroud)
这是对还是错?是否有任何好处或需要将它们合并到相同的脚本或项目数组中?
提到了几个复数形式的属性,例如events或actor。\n它在使用方面到底意味着什么?我可以按照中提到的那样将它们堆叠在一起吗这个答案中提到的那样将它们堆叠在一起吗?
\n\n我主要想知道如何处理Supersedes actors.while actors(复数) 语句在其他地方没有明确提到。我只需要寻找那个吗supersedes\xe2\x80\xa6语句并可以推断出这意味着我能够将多个这些属性(以其单数形式)背靠背放置?
比如:“取代演员。” 可以翻译为“多个actor可以使用多个属性。”?
为了进行额外的固定:不需要包裹元件,itemprop="actors"就像itemprop=actor元件堆叠的
schema.org 文档有时会提到“指针”。例如Product模式具有属性isSimilarTo。
我明白,我可以直接使用 aProduct或 a Service。例如:
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "BMW",
"isSimilarTo": {
"@type": "Product",
"name": "Mercedes Benz"
},
"offers": {
"@type": "Offer",
"priceCurrency": "EUR",
"price": "100000.00"
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
这是在这种情况下使用和解释术语“指针”的唯一且正确的方法吗?对于指针,我宁愿期望一些值(ID 或 URL 或类似的)只是指向另一个产品或服务。
我想知道如何构建我的 Schema.org。我对 JSON-LD 和微数据元素使用混合方法。我不使用它们以两种不同的方式来描述一件事。我需要一些关于包含哪些内容的指南。
现在我在每一页都有对我们公司的描述:
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Organization",
"url" : "https://our.url",
"logo" : "https://our.url/logo2.svg",
"contactPoint" : [{
"@type" : "ContactPoint",
"telephone" : "",
"contactType" : "Customer Service"
}],
"sameAs" :[],
"name" : "Our Small Company"
}
</script>
Run Code Online (Sandbox Code Playgroud)
然后我在 JSON-LD 中再次对我们的网页进行了简短的描述:
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "WebSite",
"url" : "http://our.url",
"potentialAction" : {
"@type" : "SearchAction",
"target" : "http://our.url/search",
"query-input" : "required name=search_term_string"
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
从这里开始,我拥有所有元素的微数据。例如搜索结果是带有产品的 ItemList 等。
这看起来好吗?我应该在每个页面上包含 JSON-LD …
我们希望使用 JSON-LD 格式以FAQPage的形式添加特色片段。使用 Google 页面概述上的“查看标记”链接FAQPage,我们可以获得下面的示例特色片段。这似乎意味着该页面的所有问题都应该在一个<script>标签中。
我们通过Google 的结构化数据测试工具和丰富结果工具运行了以下内容,它返回了零错误。然而,没有提到它全部在一个script标签中。
如果我们要使用FAQPage特色片段,我们需要使用的正确变体是什么(1 或 2)?
变体 1 - 将所有问题集中在一个script标签中:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "What is the return policy?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Most unopened items in new condition and returned within <strong>90 days</strong> will receive a refund or exchange. Some items have a modified return policy noted on the receipt …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用结构化数据来指定多个组织(见下文)。但谷歌的结构化数据测试工具只能识别每种类型的第一项。
如何列出多个alumniOf项目?
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"name": "My Org",
"founder": {
"@type": "Person",
"name":"Me",
"alumniOf":{
"@type": "Organization",
"name": "My Org 1"
},
"alumniOf":{
"@type": "Organization",
"name": "My Org 2"
}
}
</script>
Run Code Online (Sandbox Code Playgroud)