FIX: improves micro data support

This commit is contained in:
Joffrey JAFFEUX 2018-06-13 23:20:48 +02:00 committed by GitHub
parent ff06ce4cce
commit 276526e30e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 18 deletions

View File

@ -1,11 +1,14 @@
<div class='category-list' itemscope itemtype='http://schema.org/ItemList'> <div class='category-list' itemscope itemtype='http://schema.org/ItemList'>
<meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'> <meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'>
<% @category_list.categories.each do |c| %> <% @category_list.categories.each_with_index do |c, index| %>
<div class='category' itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <div class='category' itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
<meta itemprop='url' content='<%= c.url %>'> <meta itemprop='position' content='<%= index %>'>
<h2><a href='<%= c.url %>' itemprop='item'> <meta itemprop='url' content='<%= "#{Discourse.base_url}#{c.url}" %>'>
<span itemprop='name'><%= c.name %></span> <h2>
</a></h2> <a href='<%= "#{Discourse.base_url}#{c.url}" %>' itemprop='item'>
<span itemprop='name'><%= c.name %></span>
</a>
</h2>
<span itemprop='description'><%= c.description&.html_safe %></span> <span itemprop='description'><%= c.description&.html_safe %></span>
</div> </div>
<% end %> <% end %>

View File

@ -26,19 +26,14 @@
<br/> <br/>
<% if params[:page].to_i == 0 && @subcategories.present? %> <% if params[:page].to_i == 0 && @subcategories.present? %>
<div itemscope itemtype='http://schema.org/ItemList'> <% @subcategories.each do |subcategory| %>
<% @subcategories.each do |subcategory| %> <a href='<%= subcategory.url %>' itemprop='item'>
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <span itemprop='name'><%= subcategory.name %></span>
<meta itemprop='url' content='<%= subcategory.url %>'> </a>
<a href='<%= subcategory.url %>' itemprop='item'> <% if subcategory.description.present? %>
<span itemprop='name'><%= subcategory.name %></span> <span itemprop='description'><%= subcategory.description %></span>
</a>
<% if subcategory.description.present? %>
<span itemprop='description'><%= subcategory.description %></span>
<% end %>
</div>
<% end %> <% end %>
</div> <% end %>
<br/> <br/>
<% end %> <% end %>
<% end %> <% end %>
@ -47,8 +42,9 @@
<meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'> <meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'>
<% @list.topics.each_with_index do |t,i| %> <% @list.topics.each_with_index do |t,i| %>
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
<meta itemprop='position' content='<%= i %>'>
<meta itemprop='url' content='<%= t.url %>'> <meta itemprop='url' content='<%= t.url %>'>
<a href='<%= t.relative_url %>' itemprop='item'> <a href='<%= t.url %>' itemprop='item'>
<span itemprop='name'><%= t.title %></span> <span itemprop='name'><%= t.title %></span>
</a> </a>
<span class="page-links"><%= page_links(t) %></span> <span class="page-links"><%= page_links(t) %></span>