---
title: ValidBlockTagPlacement
description: Identifies block tags outside Liquid templates and layouts.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-block-tag-placement
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-block-tag-placement.md
api_name: liquid
---

# ValidBlockTagPlacement

Identifies [`{% block %}`](https://shopify.dev/docs/api/liquid/tags/block) tags in files where the tag isn't valid. You can use the `{% block %}` tag in the following files:

* Liquid templates in the `templates` directory and its subdirectories, such as `templates/index.liquid` and `templates/metaobject/product.liquid`.
* Layout files directly in the `layout` directory, such as `layout/theme.liquid`.

Theme Check reports each `{% block %}` tag in any other file, including sections, blocks, snippets, and files in subdirectories of `layout`. It reports a `{% block %}` tag nested inside another `{% block %}` tag separately.

This check skips a `{% block %}` tag with a syntax error, which [`LiquidSyntaxError`](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/liquid-syntax-error) reports instead.

***

## Examples

The following examples contain code snippets that either fail or pass this check.

### ✗ Fail

In the following example, a section uses the `{% block %}` tag, so Theme Check reports `The 'block' tag can only be used in templates/**/*.liquid and layout/*.liquid.`:

## sections/main.liquid

```liquid
{% block 'card' %}
  Card
{% endblock %}
```

### ✓ Pass

In the following example, a template uses the `{% block %}` tag, including a nested block:

## templates/index.liquid

```liquid
{% block 'outer' %}
  Before
  {% block 'inner' %}
    Inner
  {% endblock %}
  After
{% endblock %}
```

***

## Options

The following example contains the default configuration for this check:

```yaml
ValidBlockTagPlacement:
  enabled: true
  severity: error
```

| Parameter | Description |
| - | - |
| `enabled` | Whether this check is enabled. |
| `severity` | The [severity](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. |

***

## Disabling this check

Disabling this check isn't recommended. If you can't avoid violating the rule, then you should disable the check using the [comment syntax](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#disable-checks-using-liquid-comments). This ensures that you intentionally disable the check for each instance.

```liquid
{% # theme-check-disable ValidBlockTagPlacement %}
{% block 'card' %}
  Card
{% endblock %}
{% # theme-check-enable ValidBlockTagPlacement %}
```

***
