From ec2c686cec5f451b0e9a6c59edaeeac0b8cb4e9d Mon Sep 17 00:00:00 2001 From: Simon Hughesdon Date: Fri, 25 Oct 2019 08:53:30 +0100 Subject: [PATCH] Use heading component instead of h1 tag This allows us to use standard padding, borders, styles etc. This doesn't fix the issue of multiple h1s on the page, but this problem can only be addressed by first shuffling down the heading levels of the published content. At present, content within the body starts at h2, which doesn't leave us any room for separate heading levels for the page title and individual chapter titles. As mentioned in the previous commit, this is not a WCAG issue though, so I don't intend to try to fix that here. --- app/views/content_items/guide_single.html.erb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/views/content_items/guide_single.html.erb b/app/views/content_items/guide_single.html.erb index 7e01caf3d..5ef89cd8a 100644 --- a/app/views/content_items/guide_single.html.erb +++ b/app/views/content_items/guide_single.html.erb @@ -26,10 +26,14 @@
<% if @content_item.has_parts? %> - <% @content_item.parts.each do |part| %> -

class="part-title"> - <%= part["title"] %> -

+ <% @content_item.parts.each_with_index do |part, index| %> + <%= render "govuk_publishing_components/components/heading", { + text: part["title"], + id: part["slug"], + heading_level: 1, + border_top: index.zero? ? 0 : 2, + padding: true + } %> <%= render 'govuk_publishing_components/components/govspeak', content: part["body"].html_safe,