mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Merge commit '346b60358dd8ec2ca228e6635bff9d7914b398b7'
This commit is contained in:
@@ -11,6 +11,7 @@ action:
|
||||
signatures: [PAGE.Scratch]
|
||||
toc: true
|
||||
aliases: [/extras/scratch/,/doc/scratch/,/functions/scratch]
|
||||
expiryDate: 2025-11-18 # deprecated 2024-11-18
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.138.0 %}}
|
||||
@@ -23,13 +24,12 @@ Beginning with v0.138.0 the `PAGE.Scratch` method is aliased to `PAGE.Store`.
|
||||
[`PAGE.Store`]: /methods/page/store/
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
The `Scratch` method on a `Page` object creates a [scratch pad] to store and manipulate data. To create a scratch pad that is not reset on server rebuilds, use the [`Store`] method instead.
|
||||
The `Scratch` method on a `Page` object creates a [scratch pad](g) to store and manipulate data. To create a scratch pad that is not reset on server rebuilds, use the [`Store`] method instead.
|
||||
|
||||
To create a locally scoped scratch pad that is not attached to a `Page` object, use the [`newScratch`] function.
|
||||
|
||||
[`Store`]: /methods/page/store/
|
||||
[`newScratch`]: /functions/collections/newscratch/
|
||||
[scratch pad]: /getting-started/glossary/#scratch-pad
|
||||
|
||||
{{% include "methods/page/_common/scratch-methods.md" %}}
|
||||
|
||||
@@ -37,9 +37,7 @@ To create a locally scoped scratch pad that is not attached to a `Page` object,
|
||||
|
||||
The `Scratch` method is often used to set scratch pad values within a shortcode, a partial template called by a shortcode, or by a Markdown render hook. In all three cases, the scratch pad values are indeterminate until Hugo renders the page content.
|
||||
|
||||
If you need to access a scratch pad value from a parent template, and the parent template has not yet rendered the page content, you can trigger content rendering by assigning the returned value to a [noop] variable:
|
||||
|
||||
[noop]: /getting-started/glossary/#noop
|
||||
If you need to access a scratch pad value from a parent template, and the parent template has not yet rendered the page content, you can trigger content rendering by assigning the returned value to a [noop](g) variable:
|
||||
|
||||
```go-html-template
|
||||
{{ $noop := .Content }}
|
||||
|
Reference in New Issue
Block a user