Page title example

With context language labelled

Sometimes this component appears on a page that has been translated. The title will naturally be supplied in the required language but the context string may fall back to the default. In these instances we need to label the language so the page remains semantic and screenreaders can handle the switch.

The lang attribute must be set to a valid BCP47 string. A valid code can be the two or three letter language code - for example, English is en or eng, Korean is ko or kor - but if in doubt please check.

How it looks (preview)

Publication

My page title

How to call this example

<%= render "govuk_publishing_components/components/title", {
  context: "Publication",
  context_locale: "en",
  title: "My page title"
} %>