这是我的丰富网页摘要
<div vocab="http://schema.org" typeof="GovernmentOrganization">
<p>
<span property="logo"><img src="http://www.place.com/image.png" class="logo"/></span>
<span class="h2" property="name">Department Of Stuff And Things</span><br />
<span class="h4" property="department">State Agency</span><br />
<a href="http://www.place.com" class="h4 text-primary" property="url">http://www.place.com</a>
</p>
<strong>Locations:</strong><br /><br />
<div property="location" typeof="GovernmentOffice">
<p property="location" typeof="PostalAddress">
Main Office<br />
<span property="streetAddress">555 Something Street Apt 2</span><br />
<span property="addressLocality">Jacksonville</span>
<span property="addressRegion">FL</span>
<span property="postalCode">11111</span><br />
<span property="addressCountry">US</span>
</p>
</div>
<strong>Services:</strong><br /><br />
<div property="hasOfferCatalog" typeof="OfferCatalog">
<div property="itemListElement" typeof="GovernmentService">
<p>
<strong><span property="name">Service 1</span></strong><br />
<span property="category">Web Based</span><br />
<span property="description">Get Some stuff and things</span><br />
<a href="https://www.place.com/Service1" property="url">https://www.place.com/Service1</a><br />
</p>
</div>
<div property="itemListElement" typeof="GovernmentService">
<p>
<strong><span property="name">Apply For Benefits</span></strong><br />
<span property="category">Phone Based</span><br />
<span property="description">This service helps you apply for the benefits you deserve</span><br />
<a href="https://www.place.com/Service2" property="url">https://www.place.com/Service1</a><br />
</p>
</div>
</div>
结构化数据测试工具似乎可以适当地组织和验证所有内容,包括我的一小部分服务(OfferCatalog)。当对Custom Search API做出请求并且在:more:pagemap:政府组织的事情似乎没问题时,我得到了我期望的结果。但是,页面映射的JSON对象仅包括我的组织的第一级:
"pagemap": {
"GovernmentOrganization": [
{
"name": "Department Of Stuff And Things",
"department": "State Agency",
"url": "http://www.place.com"
},
关于为什么我的相关对象(GovernmentOffice / locations / OfferCatalog / GovernmentServices)不包括在内的任何想法?有没有更好的方法来组织和构建Google?
答案 0 :(得分:0)
考虑这种方法。在文档中包含以下JSON-LD
脚本。它可以去任何地方,但考虑将它放在RDFa
DIV:
<script type="application/ld+json" id="">
{
"@context":
{
"@vocab": "http://schema.org/",
"@base": "http://www.place.com/"
},
"@graph": [
{
"@id": "_:ub220bL18C41",
"@type": "PostalAddress",
"addressCountry": "US",
"addressLocality": "Jacksonville",
"addressRegion": "FL",
"postalCode": "11111",
"streetAddress": "555 Something Street Apt 2"
},
{
"@id": "_:ub220bL4C1",
"@type": "GovernmentOrganization",
"department": "State Agency",
"hasOfferCatalog": {
"@id": "_:ub220bL6C40"
},
"location": {
"@id": "_:ub220bL17C33"
},
"logo": "",
"name": "Department Of Stuff And Things",
"url": "http://www.place.com"
},
{
"@id": "_:ub220bL17C33",
"@type": "GovernmentOffice",
"location": {
"@id": "_:ub220bL18C41"
}
},
{
"@id": "_:ub220bL6C40",
"@type": "OfferCatalog",
"itemListElement": [
{
"@id": "_:ub220bL12C17"
},
{
"@id": "_:ub220bL7C48"
}
]
},
{
"@id": "_:ub220bL12C17",
"@type": "GovernmentService",
"category": "Web Based",
"description": "Get Some stuff and things",
"name": "Service 1",
"url": "https://www.place.com/Service1"
},
{
"@id": "_:ub220bL7C48",
"@type": "GovernmentService",
"category": "Phone Based",
"description": "This service helps you apply for the benefits you deserve",
"name": "Apply For Benefits",
"url": "https://www.place.com/Service2"
}
]
}
</script>
您希望将@base
更改为您的网站,并决定如何整理目录结构以管理您的标识符。然后将每个空白节点更改为适当的标识符。然后最小化JSON-LD。
JSON-LD在语义上与RDFa完全相同。因此,您将能够分析Google pagemap
并确定哪种策略更适合您。如果JSON-LD
在语义上与HTML/RDFa
标记相同,我不希望Google对该网页进行处罚。
答案 1 :(得分:0)
根据Google:
我相信您在JSON API中只看到一个属性值。
我想更新一下,根据JSON API中的设计,我们只显示一个属性值,而在XML中我们显示所有值。
我们已经有一个功能请求#16696973来显示JSON API中的所有属性值。目前,我没有实施ETA。
作为一种解决方法,您必须使用XML API。