Skip to content

Commit

Permalink
Complete documentation on '.Scratch' and '.Store' (#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
deining authored Mar 21, 2023
1 parent fa7b2e2 commit 97e5567
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
15 changes: 10 additions & 5 deletions content/en/variables/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/).
Expand Down Expand Up @@ -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
10 changes: 7 additions & 3 deletions content/en/variables/shortcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 97e5567

Please sign in to comment.