Theme Tags

Theme Tags have various functions, including:\n- Outputting template-specific HTML markup\n- Telling the theme which layout and snippets to use\n- Splitting a returned array into multiple pages.

In this article:


csrfmetatags

This is a required tag. It must be used in all files in the layouts folder of your theme. This tag should be placed below and tags in the of your layout file.

<meta charset="utf-8"> {% csrf_meta_tags %}

contentforheader

This is a required tag. It must be used in all files in the layouts folder of your theme. This tag should be placed at the end of the tag in your layout file.

<head> <meta charset="utf-8"> {% csrf_meta_tags %} {% content_for_header %} </head>

include

Inserts a snippet from the snippets folder of a theme.

{% include 'search_input' %} include can also pass variables present in the snippet being included. You can include multiple variable in a single include.

{% include 'search_input', class: 'primary' %}

layout

Loads an alternate template file from the layout folder of a theme. If no alternate layout is defined, the theme.liquid template is loaded by default.

{% layout 'authentication' %} You can also pass none if you don't want any layout to be used.

{% layout none %}

paginate

Splitting products, blog articles, and search results across multiple pages is a necessary component of theme design as you are limited to 50 results per page in any for loop.

The paginate tag works in conjunction with the for tag to split content into numerous pages. It must wrap a for tag block that loops through an array, as shown in the example below:

{% paginate post.comments by 10 %} {% for comment in paginate.collection %} {% include "comment" %} {% endfor %} {% endpaginate %} The by parameter is followed by an integer between 1 and 50 that tells the paginate tag how many results it should output per page.

Within paginate tags, you can access attributes of the paginate object. This includes the attributes to output the links required to navigate within the generated pages.

raw

Allows output of Liquid code on a page without being parsed.

<p>{% raw %}{{ product.title }}{% endraw %} outputs the Title of your Product.</p>

Contact support or access our 24/7 Live Chat:

Contact Support Live Chat

Need Help? Live Chat with Us.