Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: allow search engines to index tag pages. (#12248)

Vinoth Kannane3d8e828b873
diff --git a/app/controllers/robots_txt_controller.rb b/app/controllers/robots_txt_controller.rb
index 9004715b80a..1f07d51ef1a 100644
--- a/app/controllers/robots_txt_controller.rb
+++ b/app/controllers/robots_txt_controller.rb
@@ -23,7 +23,7 @@ class RobotsTxtController < ApplicationController
/u
/my
/search
- /tag
+ /tag/*/l
/g
/t/*/*.rss
/c/*.rss
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 8f6a6083518..2c8539026e7 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -23,7 +23,7 @@ class TagsController < ::ApplicationController
before_action :fetch_tag, only: [:info, :create_synonyms, :destroy_synonym]
- after_action :add_noindex_header
+ after_action :add_noindex_header, except: [:index, :show]
def index
@description_meta = I18n.t("tags.title")
diff --git a/spec/requests/tags_controller_spec.rb b/spec/requests/tags_controller_spec.rb
index 8a014743420..bc7677abd0c 100644
--- a/spec/requests/tags_controller_spec.rb
+++ b/spec/requests/tags_controller_spec.rb
@@ -29,7 +29,6 @@ describe TagsController do
tags = response.parsed_body["tags"]
expect(tags.length).to eq(1)
expect(tags[0]['text']).to eq("topic-test")
- expect(response.headers['X-Robots-Tag']).to eq('noindex')
end
end