mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 16:19:31 -04:00
997 B
997 B
title | description | categories | keywords | params | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
math.Counter | Increments and returns a global counter. |
|
The counter is global for both monolingual and multilingual sites, and its initial value for each build is 1.
{{ warnf "page.html called %d times" math.Counter }}
WARN page.html called 1 times
WARN page.html called 2 times
WARN page.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
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.