From 85d3712d05a5d86f30afbef2ed762d5613fb75aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 13 Jul 2018 19:51:57 +0200 Subject: [PATCH] Mention the newScratch template func --- content/en/functions/scratch.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/content/en/functions/scratch.md b/content/en/functions/scratch.md index 9df78fe43..2282eff1d 100644 --- a/content/en/functions/scratch.md +++ b/content/en/functions/scratch.md @@ -30,11 +30,19 @@ See [this Go issue](https://github.com/golang/go/issues/10608) for the main moti For a detailed analysis of `.Scratch` and in context use cases, see this [post](https://regisphilibert.com/blog/2017/04/hugo-scratch-explained-variable/). {{% /note %}} -## Methods +## Get a Scratch -`Scratch` is added to both `Page` and `Shortcode` -- with following methods: +From Hugo `0.43` you can also create a locally scoped `Scratch` by calling `newScratch`: + +```go-html-template +$scratch := newScratch +$scratch.Set "greeting" "Hello" +``` + +A `Scratch` is also added to both `Page` and `Shortcode`. `Sratch` have the following methods: #### .Set + Set the given value to a given key ```go-html-template