FIX: add noindex header to user profile pages.
This commit is contained in:
parent
bdff4561d4
commit
13f229808a
|
@ -73,6 +73,8 @@ class UsersController < ApplicationController
|
||||||
track_visit_to_user_profile
|
track_visit_to_user_profile
|
||||||
end
|
end
|
||||||
|
|
||||||
|
response.headers['X-Robots-Tag'] = 'noindex'
|
||||||
|
|
||||||
# This is a hack to get around a Rails issue where values with periods aren't handled correctly
|
# This is a hack to get around a Rails issue where values with periods aren't handled correctly
|
||||||
# when used as part of a route.
|
# when used as part of a route.
|
||||||
if params[:external_id] && params[:external_id].ends_with?('.json')
|
if params[:external_id] && params[:external_id].ends_with?('.json')
|
||||||
|
|
|
@ -2904,6 +2904,8 @@ describe UsersController do
|
||||||
it 'returns success' do
|
it 'returns success' do
|
||||||
get "/u/#{user.username}.json"
|
get "/u/#{user.username}.json"
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
|
expect(response.headers['X-Robots-Tag']).to eq('noindex')
|
||||||
|
|
||||||
json = JSON.parse(response.body)
|
json = JSON.parse(response.body)
|
||||||
|
|
||||||
expect(json["user"]["has_title_badges"]).to eq(false)
|
expect(json["user"]["has_title_badges"]).to eq(false)
|
||||||
|
|
Loading…
Reference in New Issue