Complete documentation on '.Scratch' and '.Store' (#2016)

This commit is contained in:
Andreas Deininger
2023-03-21 18:02:38 +01:00
committed by GitHub
parent fa7b2e299f
commit 97e5567cc1
2 changed files with 17 additions and 8 deletions
+10 -5
View File
@@ -20,10 +20,6 @@ toc: true
The following is a list of page-level variables. Many of these will be defined in the front matter, derived from file location, or extracted from the content itself.
{{% note "`.Scratch`" %}}
See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables.
{{% /note %}}
## Page Variables
.AlternativeOutputFormats
@@ -187,6 +183,14 @@ https://remarkjs.com)
.WordCount
: the number of words in the content.
## Writable Page-scoped Variables
[.Scratch][scratch]
: returns a Scratch to store and manipulate data. In contrast to the [`.Store`][store] method, this scratch is reset on server rebuilds.
[.Store][store]
: returns a Scratch to store and manipulate data. In contrast to the [`.Scratch`][scratch] method, this scratch is not reset on server rebuilds.
## Section Variables and Methods
Also see [Sections](/content-management/sections/).
@@ -352,4 +356,5 @@ The top-level key will be preferred. Therefore, the following method, when appli
[gitinfo]: /variables/git/
[File Variables]: /variables/files/
[bundle]: {{< relref "content-management/page-bundles" >}}
[scratch]: /functions/scratch
[store]: /functions/store
+7 -3
View File
@@ -39,9 +39,13 @@ toc: false
.Inner
: represents the content between the opening and closing shortcode tags when a [closing shortcode][markdownshortcode] is used
[getfunction]: /functions/get/
[markdownshortcode]: /content-management/shortcodes/#shortcodes-with-markdown
[shortcodes]: /templates/shortcode-templates/
.Scratch
: returns a writable [`Scratch`][scratch] to store and manipulate data which will be attached to the shortcode context. This scratch is reset on server rebuilds.
.InnerDeindent {{< new-in "0.100.0" >}}
: Gets the `.Inner` with any indentation removed. This is what's used in the built-in `{{</* highlight */>}}` shortcode.
[getfunction]: /functions/get/
[markdownshortcode]: /content-management/shortcodes/#shortcodes-with-markdown
[shortcodes]: /templates/shortcode-templates/
[scratch]: /functions/scratch