摘要
我们有网站的规范版本和网站的AMP版本。规范版本的结构化数据与AMP版本的结构化数据匹配。
Google Search Console表示,除两个AMP页面外,所有页面在网站的规范和AMP版本上均有效。
两个AMP页面显示警告,提示:“必需的结构化数据元素中存在错误”。
当我们在Google的结构化数据测试工具中测试这些页面时,它们不会显示错误。
受影响的两个AMP页面也是仅有的两个嵌入视频(通过Vimeo)并包含与该视频相关的VideoObject标记的AMP页面。
页面的规范(非AMP)版本上存在完全相同的嵌入式视频和标记,但不会产生此错误。
我们尝试过的事情
在官方AMP Project git存储库上,类似的问题标记为已解决:https://github.com/ampproject/amphtml/issues/18227
该问题与Article对象有关,该Article对象在搜索控制台中显示相同的错误,而在结构化数据测试工具中同样未显示错误。
在这种情况下,结构化数据存在问题,尽管测试工具没有产生错误,但是那里没有绿色的“预览”按钮表明有问题。
当实现为独立属性时,VideoObject不会产生“预览”按钮。作为一种可能的解决方案,我们尝试将VideoObject属性嵌套在常规的'AutomotiveBusiness'属性中。确实会产生绿色的“预览”按钮,但不能解决Search Console错误。
我们的代码
我们的结构化数据如下:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "AutomotiveBusiness",
"@id": "https://www.example.com",
"url": "https://www.example.com",
"name": "example.com",
"sameAs": [
"https://www.facebook.com/example/",
"https://twitter.com/example/"
],
"priceRange": "$-$$",
"logo": "https://amp.example.com/assets/media/logo.png",
"image": "https://amp.example.com/assets/media/feature.jpg",
"telephone": "+1 888-888-8888",
"email": "help@example.com",
"address": {
"@type": "PostalAddress",
"streetAddress": "1234 ABC Ln Suite 1",
"addressLocality": "Beverly Hills",
"addressRegion": "CA",
"postalCode": "90210",
"addressCountry": "US"
},
"areaServed": {
"@type": "Country",
"name": "United States",
"sameAs": "https://en.wikipedia.org/wiki/United_States"
},
"openingHoursSpecification": {
"@type": "OpeningHoursSpecification",
"dayOfWeek": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
],
"opens": "00:00:00",
"closes": "23:59:59"
},
"paymentAccepted": [
"Credit Card",
"Debit Card"
],
"makesOffer": {
"@type": "Offer",
"itemOffered": {
"@type": "Service",
"name": "Tire Change",
"mainEntityOfPage": {
"@type": "WebPage",
"url": "https://amp.example.com/services/tire-change/index.html",
"video": {
"@type": "VideoObject",
"name": "How to change a tire",
"description": "Learn how to change a flat tire",
"thumbnailUrl": "https://amp.example.com/assets/media/thumbnail.jpg",
"embedUrl": "https://vimeo.com/51768781",
"uploadDate": "Thu, 13 Jun 2019 10:31:57 -0400"
}
},
"description": "We offer a 24/7 flat tire change service"
},
"areaServed": {
"@type": "Country",
"name": "United States",
"sameAs": "https://en.wikipedia.org/wiki/United_States"
}
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "5",
"ratingCount": "3"
},
"review": [
{
"@type": "Review",
"author": {
"@type": "Person",
"name": "John Smith"
},
"reviewRating": {
"@type": "Rating",
"ratingValue": "5",
"bestRating": "5",
"worstRating": "1"
},
"name": "A really great review",
"reviewBody": "A really great review"
},
{
"@type": "Review",
"author": {
"@type": "Person",
"name": "Jane Doe"
},
"reviewRating": {
"@type": "Rating",
"ratingValue": "5",
"bestRating": "5",
"worstRating": "1"
},
"name": "Another great review",
"reviewBody": "Another great review"
},
{
"@type": "Review",
"author": {
"@type": "Person",
"name": "J. Citizen"
},
"reviewRating": {
"@type": "Rating",
"ratingValue": "5",
"bestRating": "5",
"worstRating": "1"
},
"name": "The best review",
"reviewBody": "The best review"
}
]
}
</script>
结果
我们希望带有以上代码的AMP页面在Google Search Console中显示为有效。
Google Search Console而是将页面显示为无效页面,并显示警告“必需的结构化数据元素中存在错误”。