# Theme tags

> The Liquid tags a theme template can use, the form types, and whitespace control.

This page lists all tags registered in the theme engine, with an example of each. Any unknown tag fails `biticaret theme check` and theme upload.

If a tag fails at render time, it does not halt the entire page: `Liquid error (sections/x.liquid line 3): …` is output in its place and the rest of the page continues rendering.

## Theme tags

| Tag | Description | Example |
| :--- | :--- | :--- |
| `section` | Renders a static section by name. | `{% section 'header' %}` |
| `sections` | Renders a section group. | `{% sections 'header-group' %}` |
| `content_for` | Renders theme blocks: `'blocks'` renders all blocks; `'block'` renders one specific block. | `{% content_for 'blocks' %}` |
| `render` | Renders a snippet (`snippets/`) in an isolated scope; supports `with`, `for` and `as`. | `{% render 'product-card', product: product %}` |
| `include` | Legacy form of `render` that shares the caller's scope. Use `render` in new code. | `{% include 'product-card' %}` |
| `layout` | Selects the template's layout; `none` renders without a layout. | `{% layout 'password' %}` |
| `form` | Renders a platform form with the appropriate action URL and hidden fields. | `{% form 'product', product %}…{% endform %}` |
| `paginate` | Paginates a list and provides the `paginate` object. | `{% paginate collection.products by 24 %}…{% endpaginate %}` |
| `schema` | Declares a section's or block's settings schema (JSON); produces no output. | `{% schema %}{ "name": "…" }{% endschema %}` |
| `style` | Outputs a `<style>` element with Liquid evaluated inside it. | `{% style %}:root { --page-width: {{ settings.page_width }}px; }{% endstyle %}` |
| `stylesheet` | Declares section CSS, compiled into the theme bundle with no inline output. | `{% stylesheet %}.card { … }{% endstylesheet %}` |
| `javascript` | Declares section JavaScript, compiled into the theme bundle with no inline output. | `{% javascript %}…{% endjavascript %}` |

### Form types

| Type | Action path |
| :--- | :--- |
| `product` | `/cart/add` |
| `cart` | `/cart` |
| `contact`, `customer` | `/contact` |
| `localization` | `/localization` |
| `currency` | `/cart/update` |
| `storefront_password` | `/password` |
| `customer_login`, `guest_login` | `/account/login` |
| `create_customer` | `/account` |
| `recover_customer_password` | `/account/recover` |
| `reset_customer_password` | `/account/reset` |
| `activate_customer_password` | `/account/activate` |
| `customer_address` | `/account/addresses` |
| `new_comment` | `/comments` |

The `create_customer`, `recover_customer_password`, `reset_customer_password`, `activate_customer_password` and `new_comment` forms render markup, but the platform rejects submissions to those paths: customers sign in with a one-time email code rather than a password, and blog comments are not supported. The `customer_login` form reads only `email` (or `customer[email]`) and sends the sign-in code.

Forms that modify a customer account or send a message (contact, sign-in, address) include a hidden `authenticity_token` field for signed-in customers; guest submissions are validated against their referring page. Cart, product, currency and `localization` forms carry no token and are accepted only from the store's own pages.

```liquid
{%- form 'product', product, class: 'form' -%}
  <input type="hidden" name="id" value="{{ current.id }}">
  <label>{{ 'products.product.quantity' | t }} <input type="number" name="quantity" value="1" min="1"></label>
  <button class="button" type="submit">{{ 'products.product.add_to_cart' | t }}</button>
{%- endform -%}
```

## Variables

| Tag | Description | Example |
| :--- | :--- | :--- |
| `assign` | Defines a variable. | `{% assign current = product.selected_or_first_available_variant %}` |
| `capture` | Captures rendered output into a variable. | `{% capture label %}{{ product.title }}{% endcapture %}` |
| `increment` | Outputs a counter starting at 0, then increments it by 1. | `{% increment counter %}` |
| `decrement` | Decrements a counter by 1, then outputs it. | `{% decrement counter %}` |
| `echo` | Outputs an expression (like `{{ … }}`) inside `{% liquid %}`. | `{% echo product.title %}` |
| `liquid` | Evaluates multiple tags one per line without delimiters. | Below |

```liquid
{%- liquid
  assign featured = section.settings.collection
  if featured == blank
    assign featured = collections.all
  endif
-%}
```

## Conditions

| Tag | Description | Example |
| :--- | :--- | :--- |
| `if`, `elsif`, `else` | Renders when the condition is truthy. | `{% if product.available %}…{% else %}…{% endif %}` |
| `unless` | Renders when the condition is falsy. | `{% unless variant.available %} disabled{% endunless %}` |
| `case`, `when`, `else` | Branches on a value. | `{% case template.name %}{% when 'product' %}…{% endcase %}` |
| `ifchanged` | Renders only when its output differs from the previous iteration. | `{% ifchanged %}{{ product.vendor }}{% endifchanged %}` |

## Loops

| Tag | Description | Example |
| :--- | :--- | :--- |
| `for`, `else` | Loops over a collection (`else` runs when empty). Accepts `limit`, `offset` and `reversed`. | `{% for product in featured.products limit: 8 %}…{% endfor %}` |
| `break` | Exits the enclosing loop. | `{% break %}` |
| `continue` | Skips to the next iteration. | `{% continue %}` |
| `cycle` | Outputs the next value in sequence on each iteration. | `{% cycle 'odd', 'even' %}` |
| `tablerow` | Outputs items as HTML table rows and cells; accepts `cols`. | `{% tablerow product in collection.products cols: 3 %}…{% endtablerow %}` |

## Comments and raw text

| Tag | Description | Example |
| :--- | :--- | :--- |
| `comment` | Ignores its body and produces no output. | `{% comment %}…{% endcomment %}` |
| `#` | Single-line comment inside a tag. | `{% # note %}` |
| `doc` | Snippet documentation block; produces no output. | `{% doc %}…{% enddoc %}` |
| `raw` | Outputs its contents literally without evaluating Liquid. | `{% raw %}{{ as is }}{% endraw %}` |

## Whitespace control

Adding hyphens (`{%-`, `-%}`, `{{-`, `-}}`) strips whitespace on the corresponding side of the tag:

```liquid
{%- if product.featured_media -%}
  <div class="product__media">{{ product.featured_media | image_url: width: 800 | image_tag: loading: 'lazy' }}</div>
{%- endif -%}
```
