{{math}} helper

Helper for doing a simple math operation. Use it in loops, for example to number items from 1 instead of 0 with @index. The helper converts both arguments to numbers before it calculates the result.

Available operations: +, -, *, /, %

Syntax:

{{math ARG_1 OPERATOR ARG_2}}

Examples:

{{math @index '+' 1}}
{{math @index '-' 1}}

Create your first website with Publii

Join thousands of creators who chose independence. Create content locally and publish lightning-fast, secure websites on your own terms.

Download Publii

Free and open source. Windows, macOS and Linux.

Read the getting started guide