Skip to content

Commit

Permalink
Use correct separator for page titles
Browse files Browse the repository at this point in the history
Use a hyphen (`-`) rather than a pipe (`|`) within page titles to be consistent with the guidance in the Service Manual [1]:

> The <title> should be based on the <h1>, and follow this format:
>
> Where do you live? - register to vote - GOV.UK

[1]: https://www.gov.uk/service-manual/design/writing-for-user-interfaces#headings-and-title
  • Loading branch information
36degrees committed Apr 17, 2020
1 parent d908439 commit 5818382
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/govuk_tech_docs/meta_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def tags
end

def browser_title
[page_title, site_name].select(&:present?).uniq.join(" | ")
[page_title, site_name].select(&:present?).uniq.join(" - ")
end

def canonical_url
Expand Down
2 changes: 1 addition & 1 deletion spec/features/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def then_there_is_a_sidebar
end

def and_there_are_proper_meta_tags
expect(page).to have_title "GOV.UK Documentation Example | My First Service"
expect(page).to have_title "GOV.UK Documentation Example - My First Service"
expect(page).to have_css 'meta[property="og:site_name"]', visible: false
end

Expand Down
4 changes: 2 additions & 2 deletions spec/govuk_tech_docs/meta_tags_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
it "combines the page title and service name" do
browser_title = generate_title(site_name: "Test Site", page_title: "The Title")

expect(browser_title).to eql("The Title | Test Site")
expect(browser_title).to eql("The Title - Test Site")
end

it "does not duplicate the page title" do
Expand Down Expand Up @@ -56,7 +56,7 @@ def generate_title(site_name:, page_title:)
"twitter:card" => "summary",
"twitter:domain" => "www.example.org",
"twitter:image" => "https://www.example.org/images/govuk-large.png",
"twitter:title" => "The Title | Test Site",
"twitter:title" => "The Title - Test Site",
"twitter:url" => "https://www.example.org/foo.html")
end

Expand Down

0 comments on commit 5818382

Please sign in to comment.