FEATURE: add Noindex to robots.txt for disallowed routes

This strips pages out of indexes that should not exist see:

https://meta.discourse.org/t/pages-listed-in-the-robots-txt-are-crawled-and-indexed-by-google/100309/11?u=sam
This commit is contained in:
Sam 2018-11-02 16:39:47 +11:00
parent 4234058358
commit d84256a876
2 changed files with 2 additions and 0 deletions

View File

@ -10,6 +10,7 @@ Crawl-delay: <%= agent[:delay] %>
<%- end -%>
<% agent[:disallow].each do |path| %>
Disallow: <%= path %>
Noindex: <%= path %>
<% end %>

View File

@ -18,6 +18,7 @@ RSpec.describe RobotsTxtController do
Discourse.stubs(:base_uri).returns('/forum')
get '/robots.txt'
expect(response.body).to include("\nDisallow: /forum/admin")
expect(response.body).to include("\nNoindex: /forum/admin")
end
end