diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-07-18 11:05:58 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-07-18 11:05:58 +0200 |
commit | 59ebc83d72b09d28d62d8600517c73a4ffe70c66 (patch) | |
tree | 1432d4fac5a6ff28ef815e6d6bb2ecb24b503c35 /docs/content/en/functions/scratch.md | |
parent | ebe4d39f175f73e4f130972cb3d74ef0af5d5761 (diff) | |
parent | b6b37a1f00f808f3c0d2715f65ca2d3091f36495 (diff) |
Merge commit 'b6b37a1f00f808f3c0d2715f65ca2d3091f36495'
Diffstat (limited to 'docs/content/en/functions/scratch.md')
-rw-r--r-- | docs/content/en/functions/scratch.md | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/docs/content/en/functions/scratch.md b/docs/content/en/functions/scratch.md index 93a1e426a..c0ecaca80 100644 --- a/docs/content/en/functions/scratch.md +++ b/docs/content/en/functions/scratch.md @@ -33,11 +33,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 |