Ruby rails,Solidus 电子商务,google 索引问题
Ruby on rails, Solidus e-comerce, problem with google indexing
Google 索引在我的网站上停止并出现类似
的错误
"invalid value type for "name" field.
生成此 HTML 的 rails 代码是
<% if products.any? %>
<ul id="products" class="inline product-listing" data-hook>
<% products.each do |product| %>
<% url = spree.product_path(product, taxon_id: @taxon.try(:id)) %>
<li id="product_<%= product.id %>" class="columns three <%= cycle("alpha", "secondary", "", "omega secondary", name: "classes") %>" data-hook="products_list_item" itemscope it
emtype="http://schema.org/Product">
<% cache(@taxon.present? ? [I18n.locale, current_pricing_options, @taxon, product] : [I18n.locale, current_pricing_options, product]) do %>
<div class="product-image">
<%= link_to(render('spree/shared/image', image: product.gallery.images.first, size: :small, itemprop: "image"), url, itemprop: 'url') %>
</div>
<%= link_to(truncate(product.name, length: 50), url, class: 'info', itemprop: "name", title: product.name) %>
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<% if price = product.price_for(current_pricing_options) %>
<span class="price selling" itemprop="price" content="<%= price.to_d %>">
<%= price.to_html %>
</span>
<% end %>
<span itemprop="priceCurrency" content="<%= current_pricing_options.currency %>"></span>
</span>
<% end %>
</li>
<% end %>
该页面显示正常,但未在 google 中建立索引。我怎样才能解决这个问题? rails 代码中有 so 的语法错误吗?我没有看到一个。是什么原因造成的?
我通过重写包裹在 html header 标签中的 rails 代码解决了这个问题,如下所示:
<h6 style="color:Black;" class="info" itemprop="name">
<%= link_to(truncate(product.name, length: 50), url, title: product.name) %>
</h6>
Google 索引在我的网站上停止并出现类似
的错误"invalid value type for "name" field.
生成此 HTML 的 rails 代码是
<% if products.any? %>
<ul id="products" class="inline product-listing" data-hook>
<% products.each do |product| %>
<% url = spree.product_path(product, taxon_id: @taxon.try(:id)) %>
<li id="product_<%= product.id %>" class="columns three <%= cycle("alpha", "secondary", "", "omega secondary", name: "classes") %>" data-hook="products_list_item" itemscope it
emtype="http://schema.org/Product">
<% cache(@taxon.present? ? [I18n.locale, current_pricing_options, @taxon, product] : [I18n.locale, current_pricing_options, product]) do %>
<div class="product-image">
<%= link_to(render('spree/shared/image', image: product.gallery.images.first, size: :small, itemprop: "image"), url, itemprop: 'url') %>
</div>
<%= link_to(truncate(product.name, length: 50), url, class: 'info', itemprop: "name", title: product.name) %>
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<% if price = product.price_for(current_pricing_options) %>
<span class="price selling" itemprop="price" content="<%= price.to_d %>">
<%= price.to_html %>
</span>
<% end %>
<span itemprop="priceCurrency" content="<%= current_pricing_options.currency %>"></span>
</span>
<% end %>
</li>
<% end %>
该页面显示正常,但未在 google 中建立索引。我怎样才能解决这个问题? rails 代码中有 so 的语法错误吗?我没有看到一个。是什么原因造成的?
我通过重写包裹在 html header 标签中的 rails 代码解决了这个问题,如下所示:
<h6 style="color:Black;" class="info" itemprop="name">
<%= link_to(truncate(product.name, length: 50), url, title: product.name) %>
</h6>