nhsuk / nhsuk-frontend

NHS.UK frontend contains the code you need to start building user interfaces for NHS websites and services.
https://nhsuk.github.io/nhsuk-frontend/
MIT License
616 stars 107 forks source link

Allow override for copyright in footer macro #485

Closed GrilloPress closed 5 years ago

GrilloPress commented 5 years ago

Reviewing some work with @samanthasaw and we noticed you couldn't override the copyright notice in the footer macro.

Not every service will be crown copyright. Either at all, or may have more complicated copyright issues.

Probably should be able to either toggle the visibility and use a different copyright

chrimesdev commented 5 years ago

Hi @GrilloPress and @samanthasaw

Thanks for raising this issue - as you know the team is abit smaller than it used to be and have other commitments (along with a growing issues list).

Is this something you could potentially give a go and open a pull request with the proposed changes?

GrilloPress commented 5 years ago

Will do. I've just had a look at the macro and think I could do it.

I'll set up a branch for review

chrimesdev commented 5 years ago

@GrilloPress something along the lines of this would probably do the trick:

template.njk

<p class="nhsuk-footer__copyright">{% if params.copyright %}{{ params.copyright }}{% else %}&copy; Crown copyright{% endif %}</p>

then the macro would be:

{{ footer({
  "links": [
    {
      "URL": "https://www.nhs.uk/nhs-sites/",
      "label": "NHS sites"
    },
    {
      "URL": "https://www.nhs.uk/about-us/",
      "label": "About us"
    },
    {
      "URL": "https://www.nhs.uk/contact-us/",
      "label": "Contact us"
    },
    {
      "URL": "https://www.nhs.uk/about-us/sitemap/",
      "label": "Sitemap"
    },
    {
      "URL": "https://www.nhs.uk/our-policies/",
      "label": "Our policies"
    }
  ],
 "copyright": "Custom copyright text"
})}}

parameters:

copyright - string - not required

GrilloPress commented 5 years ago

Yeah that's pretty much what I'm thinking. Just need to sit down and do it.

Would we want to escape the text just in case? or provide an html or text switch?

chrimesdev commented 5 years ago

HTML could be used but that means people could put anything in there (eg. Care cards), we may want to stick to just text. As any custom HTML probably would fit in the there anyway.

chrimesdev commented 5 years ago

This is done just waiting for next release.

chrimesdev commented 5 years ago

This has been released in v2.3.1.

Thanks @GrilloPress for raising the issue.