mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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
|
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 :ensure_logged_in, only: [:notifications, :update_notifications, :update]
|
||||||
before_filter :set_category_from_params, except: [:index, :update, :destroy, :tag_feed, :search, :notifications, :update_notifications]
|
before_filter :set_category_from_params, except: [:index, :update, :destroy, :tag_feed, :search, :notifications, :update_notifications]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
tag_counts = self.class.tags_by_count(guardian, limit: 300).count
|
tag_counts = self.class.tags_by_count(guardian, limit: 300).count
|
||||||
tags = tag_counts.map {|t, c| { id: t, text: t, count: c } }
|
@tags = tag_counts.map {|t, c| { id: t, text: t, count: c } }
|
||||||
render json: { tags: tags }
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html do
|
||||||
|
render :index
|
||||||
|
end
|
||||||
|
format.json do
|
||||||
|
render json: { tags: @tags }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Discourse.filters.each do |filter|
|
Discourse.filters.each do |filter|
|
||||||
|
20
app/views/tags/index.html.erb
Normal file
20
app/views/tags/index.html.erb
Normal 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 %>
|
@ -3025,6 +3025,7 @@ en:
|
|||||||
user_exists: "Sorry, that user has already been invited. You may only invite a user to a topic once."
|
user_exists: "Sorry, that user has already been invited. You may only invite a user to a topic once."
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
|
title: "Tags"
|
||||||
staff_tag_disallowed: "The tag \"%{tag}\" may only be applied by staff."
|
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."
|
staff_tag_remove_disallowed: "The tag \"%{tag}\" may only be removed by staff."
|
||||||
rss_by_tag: "Topics tagged %{tag}"
|
rss_by_tag: "Topics tagged %{tag}"
|
||||||
|
Loading…
Reference in New Issue
Block a user