Using CounterPlugin

Last modified: 4/23/2026

Using CounterPlugin

The CounterPlugin maintains page-level counters that increment each time they render — useful for numbering figures, sections, or any sequential items on a page.

Description

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.

Syntax

[{Counter}] renders as:

1

Parameters

ParameterTypeDefaultDescription
namestringcounterIdentifies the counter — counters with different names are independent
incrementnumber1Amount added each time the plugin renders. Use a negative number to count down.
startnumber(none)Resets the counter to this value before incrementing
showResultbooleantrueSet to false to increment silently without displaying the value

Examples

Basic Counter

Three calls to the default counter:

[{Counter name='ex1' start='1'}]
[{Counter name='ex1'}]
[{Counter name='ex1'}] renders as:

1
1
1

Named Counter

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

Custom Increment

[{Counter name='byten' start='10'}]
[{Counter name='byten' increment='10'}]
[{Counter name='byten' increment='10'}] renders as:

10
10
10

Countdown

[{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

Accessing Counter Values as Variables

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}

Use Cases

Numbered sections with a reset

# 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'}]

Silent tracking

[{Counter name='views' showResult='false'}]
Views this render: [{$counter-views}]