From 97e5567cc1b95bbb9fc874d24366a0acbe3d5c76 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Tue, 21 Mar 2023 18:02:38 +0100 Subject: [PATCH] Complete documentation on '.Scratch' and '.Store' (#2016) --- content/en/variables/page.md | 15 ++++++++++----- content/en/variables/shortcodes.md | 10 +++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/content/en/variables/page.md b/content/en/variables/page.md index 3453b8a2bc..681f2d1f7c 100644 --- a/content/en/variables/page.md +++ b/content/en/variables/page.md @@ -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 diff --git a/content/en/variables/shortcodes.md b/content/en/variables/shortcodes.md index a7c9e475b8..483973eb02 100644 --- a/content/en/variables/shortcodes.md +++ b/content/en/variables/shortcodes.md @@ -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 `{{}}` shortcode. + +[getfunction]: /functions/get/ +[markdownshortcode]: /content-management/shortcodes/#shortcodes-with-markdown +[shortcodes]: /templates/shortcode-templates/ +[scratch]: /functions/scratch \ No newline at end of file