Skip to content

Commit

Permalink
Add noindex for '/help/cookie-details'
Browse files Browse the repository at this point in the history
We don't want to have this page appearing in our search, but instead for
users to see '/help/cookies' as the only result because the details page
is confusing as a landing page. The settings page also links to the
details page.
  • Loading branch information
chao-xian committed Jun 26, 2019
1 parent aadc459 commit abf3508
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/views/content_items/help_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<%= machine_readable_metadata(
schema: :article
) %>
<% if @content_item.base_path == '/help/cookie-details' %>
<meta name="robots" content="noindex">
<% end %>
<% end %>

<%= render 'content_items/body_with_related_links' %>
10 changes: 10 additions & 0 deletions test/integration/help_page_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ class HelpPageTest < ActionDispatch::IntegrationTest
assert page.has_text?("GOV.UK puts small files (known as ‘cookies’) onto your computer to collect information about how you browse the site.")
assert_has_published_dates(@content_item["last_updated"])
end

test "sets noindex meta tag for '/help/cookie-details'" do
@content_item = get_content_example("help_page").tap do |item|
item["base_path"] = "/help/cookie-details"
content_store_has_item(item["base_path"], item.to_json)
visit_with_cachebust(item["base_path"])
end

assert page.has_css?('meta[name="robots"][content="noindex"]', visible: false)
end
end

0 comments on commit abf3508

Please sign in to comment.