本文介绍了如果标记是用JavaScript动态构建的,Schema.org标记是否工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面,通过JavaScript读取一些JSON动态加载一些事件。我使用 Event Schema.org标记为每个事件构建 div

I have a page where some events are dynamically loaded by reading some JSON with JavaScript. I build a div for every event with the Event Schema.org markup.

Google的测试工具不会读取此标记。是因为标记错误,还是因为动态载入?

Google's testing tool doesn't read this markup. Is it because of an error in the markup, or is it because of the dynamic loading?

一个事件是:

<div class="evento well" itemscope itemtype="http://schema.org/Event">
   <meta itemprop="startDate" content="2015-03-20T20:00:00.000Z">
   <meta itemprop="endDate" content="2015-01-21T20:00:00.000Z">
   <div class="dataEvento">
      <div class="dayWeekEvento">venerdì</div>
      <div class="dayNumEvento">20</div>
      <div class="monthEvento">Marzo</div>
   </div>
   <div class="datiEvento">
      <div class="oraEvento">ore 21:00</div>
      <div class="titoloEvento"><span itemprop="name">Titolo evento</span></div>
      <div class="luogoEvento" itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress"><a href="https://www.google.it/maps/place/Milano" target="_blank"><span class=" glyphicon glyphicon-map-marker" aria-hidden="true"></span> <span itemprop="addressLocality">Milano</span></a></div>
   </div>
</div>


推荐答案

仅提及如果使用语法JSON-LD,他们可以使用动态添加的结构化数据:

Google’s documentation only mentions that they can consume dynamically added structured data if the syntax JSON-LD is used:

这并不一定意味着它们在其他语法(如Microdata或RDFa)的情况下无法读取它,但至少它们不记录它。

This does not necessarily mean that they can’t read it in case of other syntaxes (like Microdata or RDFa), but at least they don’t document it.

他们的不会阅读它可能会或可能不会意味着什么(它可能是工具不处理这个,但它们的内部系统会这样做)。但是,您的实际标记应该没有问题,因为您可以通过粘贴标记而不是输入URL来轻松测试它。

That their testing tool doesn’t read it may or may not mean something (it could be that the tool doesn’t handle this but their internal system does). However, there should be no issue with your actual markup, as you can easily test it yourself by pasting your markup instead of entering your URL.

这篇关于如果标记是用JavaScript动态构建的,Schema.org标记是否工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 02:32