# Tags

Twig tags allowed in theme files, and the theme tags for schemas, styles, scripts and documentation.

<!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. -->

Tags are logic: `{% if %}`, `{% for %}`. Everything that is not listed - `extends`, `block`, `macro`, `import`, `use`, `sandbox`, `deprecated` and the rest - is refused by the sandbox.

## Theme

### `schema`

The JSON schema of a section or block - its name, settings, nested blocks and presets. Required in a block, forbidden in a snippet. It never renders.

```twig
{% schema %} { … } {% endschema %}
```

### `stylesheet`

CSS of a section or block. The platform collects every stylesheet of the theme into one file (`_sections.css`) linked in `content_for_header`, so the CSS loads once however many times the section appears.

```twig
{% stylesheet %} … {% endstylesheet %}
```

### `javascript`

JavaScript of a section or block, collected into `_sections.js` the same way as stylesheets. The platform does not link that file for you - prefer a module in `assets/`, or add `{{ '_sections.js'|asset_url|script_tag }}` to the layout.

```twig
{% javascript %} … {% endjavascript %}
```

### `doc`

Documentation of a snippet or block - its parameters. It never renders.

```twig
{% doc %} @param name - description {% enddoc %}
```

## Twig tags

### `apply`

Applies filters to a block of output.

```twig
{% apply upper %}…{% endapply %}
```

### `do`

Evaluates an expression without printing it.

```twig
{% do expression %}
```

### `else`

Part of `if` and `for`.

```twig
{% else %}
```

### `elseif`

Part of `if`.

```twig
{% elseif condition %}
```

### `for`

Loops, with `loop.index`, `loop.first`, `loop.last`; the `else` part runs for an empty list.

```twig
{% for item in list %}…{% else %}…{% endfor %}
```

### `if`

Conditions.

```twig
{% if condition %}…{% elseif other %}…{% else %}…{% endif %}
```

### `set`

Assigns a variable.

```twig
{% set name = value %}
```

### `verbatim`

Outputs Twig syntax unparsed - for client-side templates.

```twig
{% verbatim %}…{% endverbatim %}
```

### `with`

A scope with its own variables.

```twig
{% with { name: value } only %}…{% endwith %}
```

