Skip to content

Commit

Permalink
Allow attributes to be set on template <body> (#1623)
Browse files Browse the repository at this point in the history
Allow attributes to be set on template <body>
  • Loading branch information
hannalaakso committed Oct 29, 2019
2 parents bd21ff1 + d69dc3e commit 679dca2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

### New features

#### Allow attributes to be set on `<body>` of template

You can now set attributes in the `<body>` element of page template.

- [Pull request #1623: Allow attributes to be set on template <body>](https://github.com/alphagov/govuk-frontend/pull/1623).

### Fixes
- [Pull request #1620: Only add underline to back link when href exists ](https://github.com/alphagov/govuk-frontend/pull/1620).

Expand Down
2 changes: 1 addition & 1 deletion src/govuk/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{# image url needs to be absolute e.g. http://wwww.domain.com/.../govuk-opengraph-image.png #}
<meta property="og:image" content="{{ assetUrl | default('/assets') }}/images/govuk-opengraph-image.png">
</head>
<body class="govuk-template__body {{ bodyClasses }}">
<body class="govuk-template__body {{ bodyClasses }}" {%- for attribute, value in bodyAttributes %} {{attribute}}="{{value}}"{% endfor %}>
<script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
{% block bodyStart %}{% endblock %}

Expand Down

0 comments on commit 679dca2

Please sign in to comment.