大网数据广告活动
网站运营与故障问答

Structured Data | JSON | Help me validate my structured data for Google

· 52CE 我爱测

I am not able to get my structured data to return an error free response from Google's Structured Data Testing Tool. This is the code I am putting in: <script type="application/ld+json"> { "@context": "https://schema.org/", "@typ…

问题原文

原帖链接 · Jason Is My Name · CC BY-SA 4.0

I am not able to get my structured data to return an error free response from Google's Structured Data Testing Tool. This is the code I am putting in:

<script type="application/ld+json">
{
    "@context": "https://schema.org/", 
    "@type": "Product", 
    "additionalType": "http://www.productontology.org/id/Scooby_doo",
    "sku": "<?php echo $productID; ?>",
    "identifier_exists": "no",
    "gtin": "",
    "mpn": "",
    "name": "<?php echo $heading; ?>",
    "url": "https://www.blah.co.uk/services/#<?php echo $sector_id; ?>",
    "image": "<?php if($background_image != '') :?><?php echo $background_image; ?><?php else : ?><?php echo $background_video_poster; ?><?php endif;?>",
    "description": "<?php echo $text; ?>",
    "brand": "Scooby Doo",
    "aggregateRating": {
        "@type": "AggregateRating",
        "ratingValue": "5",
        "bestRating": "5",
        "worstRating": "5",
        "ratingCount": "10"
    }
}
</script>

I then receive these errors:

identifier_exists ~ no (The property identifier_exists is not recognized by Google for an object of type Product.)

offers ~ The offers field is recommended. Please provide a value if available.

review ~ The review field is recommended. Please provide a value if available.

warning ~ This Product is missing a global identifier (e.g. isbn, mpn or gtin8). Please see documentation for valid identifiers.


My confusion - I take the global_identifier out of the code, then it requests it be added in, within the new error list created when I run it without. I have also tried just using an mpn or gtin without the global identifier, still no positive result.

Please can someone help me figure out the values that are plugged in to provide 'no / null' global identifier or mpn / gtin?

Thanks, Jason.

已采纳解答

原帖链接 · Evgeniy · CC BY-SA 4.0

I would say, your code is pretty ok. Lets look at errors the test tool fires:

  • identifier_exists: you don't need to use it, Google doesn't know it
  • Warnings about missed offer and review: are not critical, but better to use.

SKU may be the same as GTIN and as MPN. Those are just product identifiers. It is fully enough to have a single one of them.

I've edited your code and checked it with testing tool - looks not bad:

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-01-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。