FEATURE: subcategories can be discovered by web crawlers on page 1 of the parent category topics list
This commit is contained in:
parent
4dac4c69a6
commit
ca20cb9941
|
@ -294,6 +294,10 @@ class ListController < ApplicationController
|
|||
|
||||
@description_meta = @category.description_text
|
||||
raise Discourse::NotFound unless guardian.can_see?(@category)
|
||||
|
||||
if use_crawler_layout?
|
||||
@subcategories = @category.subcategories.select { |c| guardian.can_see?(c) }
|
||||
end
|
||||
end
|
||||
|
||||
def build_topic_list_options
|
||||
|
|
|
@ -13,16 +13,34 @@
|
|||
<% if @category %>
|
||||
<h1>
|
||||
<% if @category.parent_category %>
|
||||
<%= link_to @category.parent_category.url, itemprop: 'item' do %>
|
||||
<span itemprop='name'><%= @category.parent_category.name %></span>
|
||||
<% end %>
|
||||
|
||||
<%= link_to @category.parent_category.url, itemprop: 'item' do %>
|
||||
<span itemprop='name'><%= @category.parent_category.name %></span>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= link_to @category.url, itemprop: 'item' do %>
|
||||
<span itemprop='name'><%= @category.name %></span>
|
||||
<% end %>
|
||||
</h1>
|
||||
<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>
|
||||
<% end %>
|
||||
</div>
|
||||
<br/>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class='topic-list' itemscope itemtype='http://schema.org/ItemList'>
|
||||
|
@ -58,7 +76,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%- end %>
|
||||
<%- end %> <!-- include_crawler_content? -->
|
||||
|
||||
<% if @rss %>
|
||||
<% content_for :head do %>
|
||||
|
|
Loading…
Reference in New Issue