Syntax Usage

Templates are made up a combination of tags, objects (variables), and filters embedded inside markup. This markup is processed by the server using pre-defined input (the request, page, entity, and user objects) in order to render every page on the site.

Tags

Tags are the mechanism by which templates are able to execute logic while rendering a page. All tags start with '{%' and end with '%}', and the commands between those characters determine how the template is processed.

Some tags are used to control what is or isn't output as part of the page (such as conditionals, comments, and includes). Some tags are used to store or modify information in objects. Some tags are used for repetition. And some tags are just shortcuts intended to make your job easier as a template developer.

Objects

Objects contain and control all dynamic information that is used while processing a page. An object may be output directly to the page using {{ object_name }} syntax, or may be modified prior to being output using Filters (more on that below).

Some objects may not display anything when output directly to the page, while others may display multiple properties (formatted as JSON) or even a fully-rendered sub-template.

Accessible properties on objects may be accessed using either object.property syntax in most cases, though for some objects, the object['property'] syntax is required (such as for the request.query_params and request.cookies objects).

Filters

Filters may be used to modify the output of objects before either being stored in a variable or output to the page. Filters should be used as "objectName | filter_name:filter_params" (eg: {{ request.date | date: "MMM dd, YYYY"}}, or {% assign end_date = request.date | add_weeks:1 %}).