FIX: crawler view of tags index page
This commit is contained in:
parent
f072cb404e
commit
c1aded8b64
|
@ -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|
|
||||
|
|
|
@ -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 %>
|
|
@ -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}"
|
||||
|
|
Loading…
Reference in New Issue