diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-01-27 10:47:28 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-01-27 10:47:28 +0100 |
commit | fc7de7136acbcf0aef54ae8460c7702bc83709be (patch) | |
tree | c109bb4dd1f1b054db476e7e4117f79bdd62ec9e /docs/content/en/functions/math/Counter.md | |
parent | 1083bf7c08e6f35826279065b8a09a16cc991c7f (diff) | |
download | hugo-fc7de7136acbcf0aef54ae8460c7702bc83709be.tar.gz hugo-fc7de7136acbcf0aef54ae8460c7702bc83709be.zip |
docs: Prepare for new sub tree
See #11925
Diffstat (limited to 'docs/content/en/functions/math/Counter.md')
-rw-r--r-- | docs/content/en/functions/math/Counter.md | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/docs/content/en/functions/math/Counter.md b/docs/content/en/functions/math/Counter.md deleted file mode 100644 index 7f53bdd0c..000000000 --- a/docs/content/en/functions/math/Counter.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: math.Counter -description: Increments and returns a global counter. -categories: [] -keywords: [] -action: - aliases: [] - related: [] - returnType: uint64 - signatures: [math.Counter] ---- - -The counter is global for both monolingual and multilingual sites, and its initial value for each build is 1. - -```go-html-template -{{ warnf "single.html called %d times" math.Counter }} -``` - -```sh -WARN single.html called 1 times -WARN single.html called 2 times -WARN single.html called 3 times -``` - -Use this function to: - -- Create unique warnings as shown above; the [`warnf`] function suppresses duplicate messages -- Create unique target paths for the `resources.FromString` function where the target path is also the cache key - -[`warnf`]: /functions/fmt/warnf -[`resources.FromString`]: /functions/resources/fromstring - -{{% note %}} -Due to concurrency, the value returned in a given template for a given page will vary from one build to the next. You cannot use this function to assign a static id to each page. -{{% /note %}} |