From 142618985ae80c250ccb0d9efcc0f978eefef917 Mon Sep 17 00:00:00 2001 From: Mark Green Date: Thu, 30 Jul 2020 16:15:44 +0100 Subject: [PATCH] Further changes from SME review --- src/styles/page-template/index.md.njk | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/styles/page-template/index.md.njk b/src/styles/page-template/index.md.njk index 57d11f79d5..b921a44ed5 100644 --- a/src/styles/page-template/index.md.njk +++ b/src/styles/page-template/index.md.njk @@ -38,7 +38,29 @@ You can customise the page template, for example, by adding a service name and n ## Changing template content -If you’re using Nunjucks, you can change the template’s content using [options](https://frontend.design-system.service.gov.uk/use-nunjucks/#changing-the-html-thats-generated). +If you’re using Nunjucks, you can change the template’s content using options. + +How you set an option depends on whether it's a 'variable' option or a 'block' option. + +To set a 'variable' option, use `set` to pass in a single value or string. For example, to add a class to the `` element using the `bodyClasses` option: + +```javascript +{% raw %} +{% set bodyClasses = "EXAMPLE-CLASS" %} +{% endraw %} +``` + +To set a 'block' option, use `block` to pass in a multiline value or HTML markup. For example, to add a block of HTML before the closing element in the page template using the `bodyEnd` option: + +```javascript +{% raw %} +{% block bodyEnd %} +
+

Example text

+
+{% endblock %} +{% endraw %} +``` To change the components that are included in the page template by default, set their equivalent blocks. For example: @@ -52,6 +74,8 @@ To change the components that are included in the page template by default, set {% endraw %} ``` +### Options +
Options that you can use with the page template