From c94e6a9a66757ea48d99e3ee8d880523871cb6f4 Mon Sep 17 00:00:00 2001 From: Joshua Rosenfeld Date: Tue, 12 May 2020 10:44:46 -0400 Subject: [PATCH] FEATURE: add noindex header to tags pages (#9748) --- app/controllers/tags_controller.rb | 2 ++ spec/requests/tags_controller_spec.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index ada5d6f66d..51cbb5297b 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -24,6 +24,8 @@ class TagsController < ::ApplicationController before_action :fetch_tag, only: [:info, :create_synonyms, :destroy_synonym] + after_action :add_noindex_header + def index @description_meta = I18n.t("tags.title") @title = @description_meta diff --git a/spec/requests/tags_controller_spec.rb b/spec/requests/tags_controller_spec.rb index b4c0b866ea..926e506e35 100644 --- a/spec/requests/tags_controller_spec.rb +++ b/spec/requests/tags_controller_spec.rb @@ -29,6 +29,7 @@ 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