Theme tags
Theme tags have many functions, including:
- Outputting template-specific HTML markup
- Telling the theme which layout and snippets to use
- Splitting a returned array into multiple pages.
comment
Allows you to leave un-rendered code inside a Liquid template. Any text within the opening and closing comment
blocks will not be output, and any Liquid code within will not be executed.
My name is Wilson Abercrombie{% comment %}, esquire {% endcomment %}
My name is Wilson Abercrombie.
paginate
Splitting products, blog articles, and search results across multiple pages is a necessary part of theme design as you are limited to 50 results per page in any for loop.
The paginate
tag works with the for
tag to split content into many pages. It must wrap a for
tag block that loops through an array, as shown in the example below:
{% paginate collection.products by 5 %}
{% for product in collection.products %}
<!--show product details here -->
{% endfor %}
{% endpaginate %}
raw
Allows output of Liquid code on a page without being parsed.
{% raw %}{{ 5 | plus: 6 }}{% endraw %} equals 11.
{{ 5 | plus: 6 }} equals 11.
Updated over 3 years ago