mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-01 15:01:47 +00:00
Discourage search engines from indexing old versions of wiki pages (#29503).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17690 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
8a0a3bc8ed
commit
e6e02e5e45
@ -99,4 +99,8 @@
|
||||
<%= render :partial => 'sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= robot_exclusion_tag unless @content.current_version? %>
|
||||
<% end %>
|
||||
|
||||
<% html_title @page.pretty_title %>
|
||||
|
||||
@ -1182,4 +1182,17 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
attachment = Attachment.order('id DESC').first
|
||||
assert_equal Wiki.find(1).find_page('CookBook_documentation'), attachment.container
|
||||
end
|
||||
|
||||
def test_old_version_should_have_robot_exclusion_tag
|
||||
@request.session[:user_id] = 2
|
||||
# Discourage search engines from indexing old versions
|
||||
get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2'}
|
||||
assert_response :success
|
||||
assert_select 'head>meta[name="robots"][content=?]', 'noindex,follow,noarchive'
|
||||
|
||||
# No robots meta tag in the current page
|
||||
get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation'}
|
||||
assert_response :success
|
||||
assert_select 'head>meta[name="robots"]', false
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user