mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 12:57:29 +08:00
DEV: Also noindex embedded comments (#27221)
For some reason, despite iframe also indicating a ``` <meta name="robots" content="noindex"> ``` .. Google is still indexing the embed/comment URLs. This causes links like http://\<site>/embed/comments\?topic_id\=6366 to be indexed instead of the topic. This commit adds it explicitly in the header.
This commit is contained in:
parent
9c85ea5945
commit
61c6d2a7fc
|
@ -85,13 +85,13 @@ class EmbedController < ApplicationController
|
||||||
raise Discourse::InvalidAccess.new("invalid embed host")
|
raise Discourse::InvalidAccess.new("invalid embed host")
|
||||||
end
|
end
|
||||||
|
|
||||||
topic_id = nil
|
|
||||||
if embed_url.present?
|
if embed_url.present?
|
||||||
topic_id = TopicEmbed.topic_id_for_embed(embed_url)
|
topic_id = TopicEmbed.topic_id_for_embed(embed_url)
|
||||||
else
|
else
|
||||||
topic_id = params[:topic_id].to_i
|
topic_id = params[:topic_id].to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
response.headers["X-Robots-Tag"] = "noindex, indexifembedded"
|
||||||
if topic_id
|
if topic_id
|
||||||
@topic_view =
|
@topic_view =
|
||||||
TopicView.new(
|
TopicView.new(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user