alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
306 stars 236 forks source link

Make it easier to set unique title tags for pages #1975

Closed frankieroberto closed 1 year ago

frankieroberto commented 1 year ago

Currently when a new prototype is generated, the default layout file extends govuk-prototype-kit/layouts/govuk-branded.html which sets the title tag for each page to be GOV.UK Prototype Kit.

Prototypes can override this by setting the pageTitle block in either their own layout file, or on individual pages. However it’s relatively easy to forget this.

Perhaps this could be made easier by setting the default page title to be {{ title }} - {{ serviceName}} - GOV.UK which would match the GDS style guide for page titles. Then pages could use {% set title = "" %} to set the page title, whilst having a service-wide suffix.

The templates installed using the admin interface could set default page titles too.

See discussion on Slack.

36degrees commented 1 year ago

Then pages could use {% set title = "" %} to set the page title, whilst having a service-wide suffix.

Worth noting that this would be a change in behaviour compared to the documentation for pageTitle on https://design-system.service.gov.uk/styles/page-template/

Maybe that's already the case for other options on that page but I think there's value in trying to avoid having two different ways of doing things.

But equally if {% block pageTitle %} still works as well, maybe that's OK.

frankieroberto commented 1 year ago

Possibly related: #1952?

joelanman commented 1 year ago

@frankieroberto nah thats unrelated - thats just us not titling our internal pages properly :)

@36degrees I don't think this conflicts - {% block pageTitle %} is still available, title is just adding value here by constructing [title] - [serviceName] - GOV.UK for you in the Prototype Kit. But I agree the naming might be tricky. Ah naming. pageName ?

joelanman commented 1 year ago

closed in https://github.com/alphagov/govuk-prototype-kit/pull/2030