Data Structure

2026-06-23

Constants (Literals)

The following literal types are supported:

  1. Boolean: true, false, True, False.
  2. Integer: for example: -1, 0, 1, 2.
  3. Float: for example: 1.2, 1.0.
  4. String: text wrapped in quotes (single quotes ', double quotes ", or backticks `; must use ASCII half-width characters). Opening and closing quotes must match. If the string contains the same type of quote, use a different quote type for the outer wrapper. For example, "Welcome to 'Everkm' Notes".
  5. List: wrapped with [ and ], items separated by half-width commas. All items must be of the same type; a trailing comma is allowed. For example, ["abc", "efg",].

Variables

Variables are typically defined in the template context, but can also be defined within a template.

Variable types include all the literal types listed above, plus object types. An object is a collection of one or more key-value pairs where keys must be strings, values can be any other type, different pairs may have different value types, and values can themselves be objects, forming nested structures.

Variables can be rendered using the {{var_name}} syntax.

System Global Variables

  • __publish_context context of the current template
  • __qs query parameters of the current page (Query string), including folders.*.query config items; page parameters override config items with the same name
  • __config the config configuration items
  • __page_path file path corresponding to the current page
  • __page_path_base same as __page_path, but without the file extension
  • __breadcrumbs breadcrumb navigation. Data structure: [{"title":"", url: ""}]
  • __lang the configured language code
  • __tpl_path current template path
  • __host host of the current preview address
  • __env_is_preview whether this is a preview environment (boolean)
  • __everkm_publish_version current tool version
  • __theme_version current theme version
  • __theme_name current theme name

Dot Operator

When accessing a list, you can use var.0 to access the first item, with numbering starting from 0.

When accessing an object, use var.key to get the value for the specified key.

Bracket Operator

When accessing a list, you can use var[0] to access the first item.

When accessing an object, use var["key"] to get the value for the specified key.

When accessing deeply nested objects, you can chain multiple bracket accesses. For example: cities["zhongguo"]["hubei"]["wuhan"]. The content after the operator is called the index; in addition to literals, valid variables can also be used as the index.

Accessing undefined variables through the above operators will cause an error.

Expressions

The following categories of expressions are supported:

Arithmetic Operators

Everkm Publish supports basic numeric operators. Operations are only allowed on numbers (integers, floats) and numeric variables.

  • + adds the left and right operands. For example, {{1+2}} outputs 3.
  • - subtracts the right operand from the left. For example, {{2-1}} outputs 1.
  • * multiplies the left and right operands. For example, {{1*2}} outputs 2.
  • / divides the left operand by the right. For example, {{ 10 / 2 }} outputs 5.
  • % returns the remainder of the left operand divided by the right. For example, {{ 2 % 2 }} outputs 0.

Operator precedence: from lowest to highest; same-precedence operators are evaluated left to right.

  • +, -
  • *, /, %

Comparison Operators

  • == equal
  • != not equal
  • > greater than
  • >= greater than or equal
  • < less than
  • <= less than or equal

Logical Operators

  • and logical AND; returns true when both sides are true
  • or logical OR; returns true when either side is true
  • not logical NOT; negates the operand

Concatenation Operator

Concatenates all operands. Operands include strings, numbers, and other identifiers (such as functions, macros, etc.).

{{ "hello " ~ 'world' ~ `!` }}
{{ an_ident ~ " and a string" ~ another_ident }}
{{ an_ident ~ another_ident }}

in Operator

Checks whether the left operand is contained in the right operand.

{{ some_var in [1, 2, 3] }}
{{ 'index' in page.path }}
{{ an_ident not in  an_obj }}