mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 20:17:17 +00:00
Mention the newScratch template func
This commit is contained in:
1 parent
1c234db1b7
commit
85d3712d05
1 file changed
+10
-2
@@ -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/).
|
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 %}}
|
{{% /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
|
||||||
|
|
||||||
Set the given value to a given key
|
Set the given value to a given key
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
|
|||||||
Reference in new issue
Block a user