From 4483543ca04232edef4da285e4beb9ba605700f8 Mon Sep 17 00:00:00 2001 From: Jack Scotti Date: Wed, 26 Aug 2015 11:49:49 +0100 Subject: [PATCH] Add meta description tag to manuals Part of improving search result snipperts shown on external search engines. The lack of a meta-description tag makes some search result snippets unhelpful, confusing, or misleading. Ticket: https://trello.com/c/S6VUwRWQ/273-follow-up-add-meta-description-tag-to-custom-content-types --- app/views/layouts/application.html.erb | 1 + app/views/manuals/index.html.erb | 6 ++++++ spec/features/viewing_a_manual_spec.rb | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6e269614..f3c55b58 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -9,6 +9,7 @@ <%= stylesheet_link_tag "print", media: "print" %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> + <%= yield :extra_headers %> diff --git a/app/views/manuals/index.html.erb b/app/views/manuals/index.html.erb index 80304a7c..27bba020 100644 --- a/app/views/manuals/index.html.erb +++ b/app/views/manuals/index.html.erb @@ -1,3 +1,9 @@ +<% content_for :extra_headers do %> + <% if @manual.summary.present? %> + + <% end %> +<% end %> + <% content_for :title, @manual.full_title %>
<%= render partial: "header" %> diff --git a/spec/features/viewing_a_manual_spec.rb b/spec/features/viewing_a_manual_spec.rb index 0d544368..b8480d37 100644 --- a/spec/features/viewing_a_manual_spec.rb +++ b/spec/features/viewing_a_manual_spec.rb @@ -42,6 +42,12 @@ expect(page.response_headers['X-Robots-Tag']).to eq("none") end + scenario "viewing a manual with a description" do + stub_fake_manual + visit_manual "my-manual-about-burritos" + expect(page).to have_selector('meta[name="description"][content="Burrito means little donkey"]', visible: false) + end + scenario "viewing a manual section with subsections" do stub_hmrc_manual stub_hmrc_manual_section_with_subsections