The CounterPlugin maintains page-level counters that increment each time they render — useful for numbering figures, sections, or any sequential items on a page.
Counters reset on every page load. Each page view starts fresh, and different users see independent counters. This makes CounterPlugin suitable for numbering items within a page, not for tracking visits across sessions. See Plugins for a complete list of available plugins.
[{Counter}] renders as:
1
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | counter | Identifies the counter — counters with different names are independent |
increment | number | 1 | Amount added each time the plugin renders. Use a negative number to count down. |
start | number | *(none)* | Resets the counter to this value before incrementing |
showResult | boolean | true | Set to false to increment silently without displaying the value |
Three calls to the default counter:
[{Counter name='ex1' start='1'}]
[{Counter name='ex1'}]
[{Counter name='ex1'}] renders as:
1
1
1
Named counters are independent of each other and of the default counter:
[{Counter name='chapter' start='1'}]
[{Counter name='chapter'}]
[{Counter name='chapter'}] renders as:
1
1
1
[{Counter name='byten' start='10'}]
[{Counter name='byten' increment='10'}]
[{Counter name='byten' increment='10'}] renders as:
10
10
10
[{Counter name='cd' start='5'}]
[{Counter name='cd' increment='-1'}]
[{Counter name='cd' increment='-1'}]
[{Counter name='cd' increment='-1'}] renders as:
5
-1
-1
-1
Counter values are available as page variables after the plugin renders. Use [{$counter}] for the default counter, or [{$counter-name}] for a named counter:
[{Counter name='fig' start='1'}] — Figure {$counter-fig} renders as:
1 — Figure {$counter-fig}
# Section [{Counter name='section' start='1'}]
## Subsection [{Counter name='sub' start='1'}]
## Subsection [{Counter name='sub'}]
# Section [{Counter name='section'}]
## Subsection [{Counter name='sub' start='1'}]
## Subsection [{Counter name='sub'}]
[{Counter name='views' showResult='false'}]
Views this render: [{$counter-views}]