diff options
Diffstat (limited to 'docs/content/en/methods/page/Scratch.md')
-rw-r--r-- | docs/content/en/methods/page/Scratch.md | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/docs/content/en/methods/page/Scratch.md b/docs/content/en/methods/page/Scratch.md index 8fef31893..41b1d17fd 100644 --- a/docs/content/en/methods/page/Scratch.md +++ b/docs/content/en/methods/page/Scratch.md @@ -13,6 +13,16 @@ toc: true aliases: [/extras/scratch/,/doc/scratch/,/functions/scratch] --- +{{% deprecated-in 0.138.0 %}} +Use the [`PAGE.Store`] method instead. + +This is a soft deprecation. This method will be removed in a future release, but the removal date has not been established. Although Hugo will not emit a warning if you continue to use this method, you should begin using `PAGE.Store` as soon as possible. + +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. To create a locally scoped scratch pad that is not attached to a `Page` object, use the [`newScratch`] function. @@ -25,7 +35,7 @@ To create a locally scoped scratch pad that is not attached to a `Page` object, ## Determinate values -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 not determinate until Hugo renders the page content. +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: @@ -36,7 +46,7 @@ If you need to access a scratch pad value from a parent template, and the parent {{ .Store.Get "mykey" }} ``` -You can also trigger content rendering with the `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount` methods. For example: +You can also trigger content rendering with the `ContentWithoutSummary`, `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount` methods. For example: ```go-html-template {{ $noop := .WordCount }} |