FEATURE: clean up microdata breadcrumb
* do not include any breadcrumb for uncategorized * do not include the work "Categories" as a breadcrumb
This commit is contained in:
parent
ff40338f69
commit
89b475e538
|
@ -484,3 +484,6 @@ DEPENDENCIES
|
|||
uglifier
|
||||
unf
|
||||
unicorn
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.2
|
||||
|
|
|
@ -5,11 +5,10 @@ module TopicsHelper
|
|||
end
|
||||
|
||||
def categories_breadcrumb(topic)
|
||||
breadcrumb = [{url: categories_path,
|
||||
name: I18n.t('js.filters.categories.title')}]
|
||||
breadcrumb = []
|
||||
|
||||
category = topic.category
|
||||
if category
|
||||
if category && !category.uncategorized?
|
||||
if (parent = category.parent_category)
|
||||
breadcrumb.push url: parent.url, name: parent.name
|
||||
end
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
<%= render_topic_title(@topic_view.topic) %>
|
||||
</h1>
|
||||
|
||||
<% @breadcrumbs = categories_breadcrumb(@topic_view.topic)
|
||||
if @breadcrumbs.present? %>
|
||||
<div itemscope itemtype='http://schema.org/BreadcrumbList'>
|
||||
<% categories_breadcrumb(@topic_view.topic).each_with_index do |c,i| %>
|
||||
<% @breadcrumbs.each_with_index do |c,i| %>
|
||||
<span itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
||||
<%= link_to c[:url], itemprop: 'item' do %>
|
||||
<span itemprop='name'><%= c[:name] %></span>
|
||||
|
@ -12,6 +14,7 @@
|
|||
<meta itemprop='position' content='<%= i + 1 %>'>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= server_plugin_outlet "topic_header" %>
|
||||
<hr>
|
||||
|
||||
|
|
Loading…
Reference in New Issue