Skip to content

Commit

Permalink
Use heading component instead of h1 tag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sihugh committed Oct 25, 2019
1 parent 981efdb commit ec2c686
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/views/content_items/guide_single.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
<div class="govuk-grid-column-two-thirds">
<% if @content_item.has_parts? %>

<% @content_item.parts.each do |part| %>
<h1 id=<%= part["slug"] %> class="part-title">
<%= part["title"] %>
</h1>
<% @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,
Expand Down

0 comments on commit ec2c686

Please sign in to comment.