Skip to content

Commit

Permalink
Add titleSuffix as future replacement for header.organisationName
Browse files Browse the repository at this point in the history
… option (#298)

Adds `titleSuffix` option to replace the undocumented `header.organisationName` option as this value is now only used in the document title.

---------

Co-authored-by: Paul Robert Lloyd <[email protected]>
  • Loading branch information
frankieroberto and paulrobertlloyd authored Jul 23, 2024
1 parent 369c960 commit 50224c3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ module.exports = function(eleventyConfig) {
{ text: "string" },
{ text: "Browser theme colour. Must be a hex value, i.e. `#0b0c0c`" | markdown }
],
[
{ text: "titleSuffix" },
{ text: "string" },
{ text: "Value to show at the end of the document title (default is `GOV.UK`)." | markdown }
],
[
{ text: "url" },
{ text: "string" },
Expand Down
2 changes: 1 addition & 1 deletion eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ module.exports = function (eleventyConfig) {
url: 'https://x-govuk.github.io/#projects',
name: 'X-GOVUK projects'
},
titleSuffix: 'X-GOVUK',
url:
process.env.GITHUB_ACTIONS &&
'https://x-govuk.github.io/govuk-eleventy-plugin/',
stylesheets: ['/assets/application.css'],
header: {
logotype: 'x-govuk',
productName: 'Eleventy Plugin',
organisationName: 'X-GOVUK',
search: {
indexPath: '/search.json',
sitemapPath: '/sitemap'
Expand Down
4 changes: 3 additions & 1 deletion layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
{{- title if title -}}
{{- " (page " + pageNumber + " of " + pageCount + ")" if pageCount > 1 -}}
{{- " - " + options.header.productName if options.header.productName -}}
{{- " - " + options.header.organisationName -}}
{%- if options.titleSuffix or options.header.organisationName %}
{{- " - " + (options.titleSuffix if options.titleSuffix else options.header.organisationName) -}}
{%- endif %}
{% endblock %}

{% block header %}
Expand Down
3 changes: 2 additions & 1 deletion lib/data/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ const defaultOptions = {
copyright: 'crown', // Crown copyright
licence: 'ogl' // Open Government Licence v3.0
},
titleSuffix: 'GOV.UK',
header: {
homepageUrl: '/',
organisationLogo: 'crown',
organisationName: 'GOV.UK',
organisationName: 'GOV.UK', // Deprecated: will be removed in v7.0
productName: false
},
homeKey: 'Home',
Expand Down

0 comments on commit 50224c3

Please sign in to comment.