Skip to content

A platform for community discussion. Free, open, simple.

FIX: improves micro data support

Joffrey JAFFEUX276526e30ea6
diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb
index 2733cc8167b..b18334da5c0 100644
--- a/app/views/categories/index.html.erb
+++ b/app/views/categories/index.html.erb
@@ -1,11 +1,14 @@
<div class='category-list' itemscope itemtype='http://schema.org/ItemList'>
<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'>
- <meta itemprop='url' content='<%= c.url %>'>
- <h2><a href='<%= c.url %>' itemprop='item'>
- <span itemprop='name'><%= c.name %></span>
- </a></h2>
+ <meta itemprop='position' content='<%= index %>'>
+ <meta itemprop='url' content='<%= "#{Discourse.base_url}#{c.url}" %>'>
+ <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>
</div>
<% end %>
diff --git a/app/views/list/list.erb b/app/views/list/list.erb
index 7d1179c7463..4acd8e7b3c2 100644
--- a/app/views/list/list.erb
+++ b/app/views/list/list.erb
@@ -26,19 +26,14 @@
<br/>
<% if params[:page].to_i == 0 && @subcategories.present? %>
- <div itemscope itemtype='http://schema.org/ItemList'>
- <% @subcategories.each do |subcategory| %>
- <div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
- <meta itemprop='url' content='<%= subcategory.url %>'>
- <a href='<%= subcategory.url %>' itemprop='item'>
- <span itemprop='name'><%= subcategory.name %></span>
- </a>
- <% if subcategory.description.present? %>
- <span itemprop='description'><%= subcategory.description %></span>
- <% end %>
- </div>
+ <% @subcategories.each do |subcategory| %>
+ <a href='<%= subcategory.url %>' itemprop='item'>
+ <span itemprop='name'><%= subcategory.name %></span>
+ </a>
+ <% if subcategory.description.present? %>
+ <span itemprop='description'><%= subcategory.description %></span>
<% end %>
- </div>
+ <% end %>
<br/>
<% end %>
<% end %>
@@ -47,8 +42,9 @@
<meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'>
<% @list.topics.each_with_index do |t,i| %>
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
+ <meta itemprop='position' content='<%= i %>'>
<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>
</a>
<span class="page-links"><%= page_links(t) %></span>