fix-29503.diff

patch - Go MAEDA, 2018-12-05 17:53

Download (1.38 KB)

View differences:

app/views/wiki/show.html.erb (working copy)
99 99
  <%= render :partial => 'sidebar' %>
100 100
<% end %>
101 101

  
102
<% content_for :header_tags do %>
103
  <%= robot_exclusion_tag unless @content.current_version? %>
104
<% end %>
105

  
102 106
<% html_title @page.pretty_title %>
test/functional/wiki_controller_test.rb (working copy)
1182 1182
    attachment = Attachment.order('id DESC').first
1183 1183
    assert_equal Wiki.find(1).find_page('CookBook_documentation'), attachment.container
1184 1184
  end
1185

  
1186
  def test_old_version_should_have_robot_exclusion_tag
1187
    @request.session[:user_id] = 2
1188
    # Old versions should not be indexed by search engines
1189
    get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2'}
1190
    assert_response :success
1191
    assert_select 'head meta[name="robots"][content=?]', 'noindex,follow,noarchive'
1192

  
1193
    # The current version
1194
    get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation'}
1195
    assert_response :success
1196
    assert_select 'head meta[name="robots"]', false
1197
  end
1185 1198
end