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:
Natalie Tay 2024-05-28 12:59:24 +08:00 committed by GitHub
parent 9c85ea5945
commit 61c6d2a7fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -85,13 +85,13 @@ class EmbedController < ApplicationController
raise Discourse::InvalidAccess.new("invalid embed host")
end
topic_id = nil
if embed_url.present?
topic_id = TopicEmbed.topic_id_for_embed(embed_url)
else
topic_id = params[:topic_id].to_i
end
response.headers["X-Robots-Tag"] = "noindex, indexifembedded"
if topic_id
@topic_view =
TopicView.new(