mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
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
3 changed files with 9 additions and 4 deletions
|
@ -484,3 +484,6 @@ DEPENDENCIES
|
||||||
uglifier
|
uglifier
|
||||||
unf
|
unf
|
||||||
unicorn
|
unicorn
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.10.2
|
||||||
|
|
|
@ -5,11 +5,10 @@ module TopicsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def categories_breadcrumb(topic)
|
def categories_breadcrumb(topic)
|
||||||
breadcrumb = [{url: categories_path,
|
breadcrumb = []
|
||||||
name: I18n.t('js.filters.categories.title')}]
|
|
||||||
|
|
||||||
category = topic.category
|
category = topic.category
|
||||||
if category
|
if category && !category.uncategorized?
|
||||||
if (parent = category.parent_category)
|
if (parent = category.parent_category)
|
||||||
breadcrumb.push url: parent.url, name: parent.name
|
breadcrumb.push url: parent.url, name: parent.name
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
<%= render_topic_title(@topic_view.topic) %>
|
<%= render_topic_title(@topic_view.topic) %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
<% @breadcrumbs = categories_breadcrumb(@topic_view.topic)
|
||||||
|
if @breadcrumbs.present? %>
|
||||||
<div itemscope itemtype='http://schema.org/BreadcrumbList'>
|
<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'>
|
<span itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
||||||
<%= link_to c[:url], itemprop: 'item' do %>
|
<%= link_to c[:url], itemprop: 'item' do %>
|
||||||
<span itemprop='name'><%= c[:name] %></span>
|
<span itemprop='name'><%= c[:name] %></span>
|
||||||
|
@ -12,6 +14,7 @@
|
||||||
<meta itemprop='position' content='<%= i + 1 %>'>
|
<meta itemprop='position' content='<%= i + 1 %>'>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
<%= server_plugin_outlet "topic_header" %>
|
<%= server_plugin_outlet "topic_header" %>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue