FIX: crawler view of tags index page

This commit is contained in:
Neil Lalonde 2016-05-03 15:51:50 -04:00
parent f072cb404e
commit c1aded8b64
3 changed files with 32 additions and 3 deletions

View File

@ -7,14 +7,22 @@ class TagsController < ::ApplicationController
before_filter :ensure_tags_enabled
skip_before_filter :check_xhr, only: [:tag_feed, :show]
skip_before_filter :check_xhr, only: [:tag_feed, :show, :index]
before_filter :ensure_logged_in, only: [:notifications, :update_notifications, :update]
before_filter :set_category_from_params, except: [:index, :update, :destroy, :tag_feed, :search, :notifications, :update_notifications]
def index
tag_counts = self.class.tags_by_count(guardian, limit: 300).count
tags = tag_counts.map {|t, c| { id: t, text: t, count: c } }
render json: { tags: tags }
@tags = tag_counts.map {|t, c| { id: t, text: t, count: c } }
respond_to do |format|
format.html do
render :index
end
format.json do
render json: { tags: @tags }
end
end
end
Discourse.filters.each do |filter|

View File

@ -0,0 +1,20 @@
<% if crawler_layout? %>
<% content_for :title do %><%=t "tags.title" %><% end %>
<h1><%=t "tags.title" %></h1>
<div class='tags-list' itemscope itemtype='http://schema.org/ItemList'>
<% @tags.each do |tag| %>
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
<meta itemprop='url' content='<%= "#{Discourse.base_url}/tags/#{tag[:id]}" %>'>
<a href='<%= "#{Discourse.base_url}/tags/#{tag[:id]}" %>' itemprop='item'>
<span itemprop='name'>
<%= tag[:text] %>
</span>
</a>
</div>
<% end %>
</div>
<% end %>

View File

@ -3025,6 +3025,7 @@ en:
user_exists: "Sorry, that user has already been invited. You may only invite a user to a topic once."
tags:
title: "Tags"
staff_tag_disallowed: "The tag \"%{tag}\" may only be applied by staff."
staff_tag_remove_disallowed: "The tag \"%{tag}\" may only be removed by staff."
rss_by_tag: "Topics tagged %{tag}"