简体   繁体   English

API的JSON动态值未显示在结构化数据测试工具上

[英]JSON dynamic value from API not showing on Structured Data Testing Tool

I'm pulling the total number of reviews from an API and I wanted to show in a Schema.org itemprop="ratingCount" . 我正在从API中提取评论总数,并想在Schema.org itemprop="ratingCount"

Here's the API link: https://api.shopperapproved.com/aggregates/reviews/8149?token=m1n2JbxYqkDM7WNXhPdj&xml=false 这是API链接: https : //api.shopperapproved.com/aggregates/reviews/8149?token=m1n2JbxYqkDM7WNXhPdj&xml=false

HTML: HTML:

<div>Rating stars based on <span id="ttlreviews" itemprop="ratingCount"></span> ratings and reviews</div>

JavaScript: JavaScript:

<script>    
$.getJSON('https://api.shopperapproved.com/aggregates/reviews/8149?token=m1n2JbxYqkDM7WNXhPdj&xml=false', function(data) {        
document.getElementById("ttlreviews").innerHTML = data.total_reviews;
});
</script>

The page is showing the correct value. 页面显示正确的值。 However, the Structured Data Testing Tool isn't catching the value ( https://search.google.com/structured-data/testing-tool/u/0/#url=http%3A%2F%2Fsazua.apleu.servertrust.com ). 但是,结构化数据测试工具无法捕获该值( https://search.google.com/structured-data/testing-tool/u/0/#url=http%3A%2F%2Fsazua.apleu.servertrust .com )。

The Structured Data Testing Tool (SDTT) isn't very good at JavaScript. 结构化数据测试工具(SDTT)不太擅长JavaScript。

I suggest you use the Google Search Consoles URL Inspection Tool. 建议您使用Google Search Console URL检查工具。 Do a live test and copy the html it gives you into the SDTT. 进行实时测试,然后将提供的html复制到SDTT中。 You will then see what Googlebot sees. 然后,您将看到Googlebot看到的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM