FIX: prevents rendering topic-category if empty (#9720)
This commit is contained in:
parent
a9cf680f76
commit
addf9d62f8
|
@ -1012,6 +1012,8 @@ class TopicsController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
|
@tags = SiteSetting.tagging_enabled ? @topic_view.topic.tags : []
|
||||||
|
@breadcrumbs = helpers.categories_breadcrumb(@topic_view.topic) || []
|
||||||
@description_meta = @topic_view.topic.excerpt.present? ? @topic_view.topic.excerpt : @topic_view.summary
|
@description_meta = @topic_view.topic.excerpt.present? ? @topic_view.topic.excerpt : @topic_view.summary
|
||||||
store_preloaded("topic_#{@topic_view.topic.id}", MultiJson.dump(topic_view_serializer))
|
store_preloaded("topic_#{@topic_view.topic.id}", MultiJson.dump(topic_view_serializer))
|
||||||
render :show
|
render :show
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
<%= render_topic_title(@topic_view.topic) %>
|
<%= render_topic_title(@topic_view.topic) %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
<% if @breadcrumbs.present? || @tags.present? %>
|
||||||
<div class="topic-category" itemscope itemtype="http://schema.org/BreadcrumbList">
|
<div class="topic-category" itemscope itemtype="http://schema.org/BreadcrumbList">
|
||||||
<% @breadcrumbs = categories_breadcrumb(@topic_view.topic) %>
|
|
||||||
<% if @breadcrumbs.present? %>
|
|
||||||
<% @breadcrumbs.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">
|
||||||
<a href="<%= Discourse.base_url %><%= c[:url] %>" class="badge-wrapper bullet" itemprop="item">
|
<a href="<%= Discourse.base_url %><%= c[:url] %>" class="badge-wrapper bullet" itemprop="item">
|
||||||
|
@ -16,10 +15,7 @@
|
||||||
<meta itemprop="position" content="<%= i + 1 %>" />
|
<meta itemprop="position" content="<%= i + 1 %>" />
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if SiteSetting.tagging_enabled %>
|
|
||||||
<% @tags = @topic_view.topic.tags %>
|
|
||||||
<% if @tags.present? %>
|
<% if @tags.present? %>
|
||||||
<meta itemprop='keywords' content='<%= @tags.map(&:name).join(', ') %>'>
|
<meta itemprop='keywords' content='<%= @tags.map(&:name).join(', ') %>'>
|
||||||
<div class='discourse-tags list-tags'>
|
<div class='discourse-tags list-tags'>
|
||||||
|
@ -28,8 +24,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= server_plugin_outlet "topic_header" %>
|
<%= server_plugin_outlet "topic_header" %>
|
||||||
|
|
Loading…
Reference in New Issue