繁体   English   中英

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

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

我正在从API中提取评论总数,并想在Schema.org itemprop="ratingCount"

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

HTML:

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

JavaScript:

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

页面显示正确的值。 但是,结构化数据测试工具无法捕获该值( https://search.google.com/structured-data/testing-tool/u/0/#url=http%3A%2F%2Fsazua.apleu.servertrust .com )。

结构化数据测试工具(SDTT)不太擅长JavaScript。

建议您使用Google Search Console URL检查工具。 进行实时测试,然后将提供的html复制到SDTT中。 然后,您将看到Googlebot看到的内容。

暂无
暂无

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

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