Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Add meta description tag to manuals #157

Merged
merged 1 commit into from
Aug 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<%= stylesheet_link_tag "print", media: "print" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= yield :extra_headers %>
</head>
<body>
<div id="global-breadcrumb" class="header-context"></div>
Expand Down
6 changes: 6 additions & 0 deletions app/views/manuals/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<% content_for :extra_headers do %>
<% if @manual.summary.present? %>
<meta name='description' content='<%= @manual.summary %>' />
<% end %>
<% end %>

<% content_for :title, @manual.full_title %>
<article aria-labelledby="manual-title" id="content">
<%= render partial: "header" %>
Expand Down
6 changes: 6 additions & 0 deletions spec/features/viewing_a_manual_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down