diff --git a/CHANGELOG.md b/CHANGELOG.md index e363b93f8..49bdbe9ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ :new: **New features** - Make nhsuk-page-width a default so that services can override it ([PR 971](https://github.com/nhsuk/nhsuk-frontend/pull/971)) +- Make footer copyright statement configurable via Nunjucks parameters ([PR 975](https://github.com/nhsuk/nhsuk-frontend/pull/975)) ## 8.2.0 - 12 June 2024 diff --git a/app/components/footer/custom-copyright.njk b/app/components/footer/custom-copyright.njk new file mode 100644 index 000000000..0e760dfe6 --- /dev/null +++ b/app/components/footer/custom-copyright.njk @@ -0,0 +1,34 @@ +{% set html_style = 'background-color: #f0f4f5;' %} +{% set title = 'Footer (custom copyright statement)' %} +{% from 'components/footer/macro.njk' import footer %} +{% extends 'layout.njk' %} + +{% block body %} + + {{ footer({ + "copyright": "© East London NHS Foundation Trust", + "links": [ + { + "URL": "#", + "label": "Accessibility statement" + }, + { + "URL": "#", + "label": "Contact us" + }, + { + "URL": "#", + "label": "Cookies" + }, + { + "URL": "#", + "label": "Privacy policy" + }, + { + "URL": "#", + "label": "Terms and conditions" + } + ] + })}} + +{% endblock %} diff --git a/app/components/footer/footer-in-columns.njk b/app/components/footer/footer-in-columns.njk index 980ad1d26..7dc2b45ef 100644 --- a/app/components/footer/footer-in-columns.njk +++ b/app/components/footer/footer-in-columns.njk @@ -6,6 +6,7 @@ {% block body %} {{ footer({ + "copyright": "© Crown copyright", "links": [ { "URL": "#", diff --git a/app/pages/examples.njk b/app/pages/examples.njk index 6473c4dd4..107616557 100644 --- a/app/pages/examples.njk +++ b/app/pages/examples.njk @@ -72,6 +72,7 @@
  • Fieldset with inputs
  • Footer (default)
  • Footer (columns)
  • +
  • Footer (custom copyright statement)
  • Header (default)
  • Header with navigation
  • Header with search
  • diff --git a/packages/components/footer/README.md b/packages/components/footer/README.md index 34e016729..943a7551f 100644 --- a/packages/components/footer/README.md +++ b/packages/components/footer/README.md @@ -172,6 +172,7 @@ Your copyright statement must reflect the ownership of your website or service. {% from 'components/footer/macro.njk' import footer %} {{ footer({ + "copyright": "© Crown copyright", "links": [ { "URL": "#", @@ -267,6 +268,76 @@ Your copyright statement must reflect the ownership of your website or service. })}} ``` +### Footer (custom copyright statement) + +[Preview the footer (custom copyright statement) component](https://nhsuk.github.io/nhsuk-frontend/components/footer/custom-copyright.html) + +#### HTML markup + +```html + +``` + +#### Nunjucks macro + +``` +{% from 'components/footer/macro.njk' import footer %} + +{{ footer({ + "copyright": "© East London NHS Foundation Trust", + "links": [ + { + "URL": "#", + "label": "Accessibility statement" + }, + { + "URL": "#", + "label": "Contact us" + }, + { + "URL": "#", + "label": "Cookies" + }, + { + "URL": "#", + "label": "Privacy policy" + }, + { + "URL": "#", + "label": "Terms and conditions" + } + ] +})}} +``` + ### Nunjucks arguments The footer Nunjucks macro takes the following arguments: @@ -282,6 +353,7 @@ The footer Nunjucks macro takes the following arguments: | **linksColumn3** | array | No | Array of third column of navigation items for use in the footer. | | **linksColumn3.[].url** | string | No | The href of a navigation item in the third column of the footer. | | **linksColumn3.[].label** | string | No | The label of a navigation item in the third column of the footer. | +| **copyright** | string | No | Optional text for the copyright notice in the footer. Defaults to '© NHS England' | | **classes** | string | No | Optional additional classes to add to the footer container. Separate each class with a space. | | **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the footer container. | | **copyright** | string | No | The label for the copyright notice in the footer. | diff --git a/packages/components/footer/template.njk b/packages/components/footer/template.njk index 903485217..572361903 100644 --- a/packages/components/footer/template.njk +++ b/packages/components/footer/template.njk @@ -1,3 +1,5 @@ +{%- set copyrightText = params.copyright if params.copyright else '© NHS England' -%} +