mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'
This commit is contained in:
@@ -42,7 +42,7 @@ Since Hugo 0.43, there are two different ways of using Scratch:
|
||||
|
||||
#### The local `newScratch`
|
||||
|
||||
{{< new-in "0.43" >}} A Scratch instance can also be assigned to any variable using the `newScratch` function. In this case, no Page or Shortcode context is required and the scope of the scratch is only local. The methods detailed below are available from the variable the Scratch instance was assigned to.
|
||||
A Scratch instance can also be assigned to any variable using the `newScratch` function. In this case, no Page or Shortcode context is required and the scope of the scratch is only local. The methods detailed below are available from the variable the Scratch instance was assigned to.
|
||||
|
||||
```go-html-template
|
||||
{{ $data := newScratch }}
|
||||
@@ -77,7 +77,7 @@ Get the value of a given key.
|
||||
|
||||
#### .Add
|
||||
|
||||
Add a given value to existing value(s) of the given key.
|
||||
Add a given value to existing value(s) of the given key.
|
||||
|
||||
For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
|
||||
|
||||
@@ -138,7 +138,7 @@ Return an array of values from `key` sorted by `mapKey`.
|
||||
|
||||
#### .Delete
|
||||
|
||||
{{< new-in "0.38" >}} Remove the given key.
|
||||
Remove the given key.
|
||||
|
||||
```go-html-template
|
||||
{{ $scratch.Set "greeting" "Hello" }}
|
||||
|
Reference in New Issue
Block a user