---
title: SchemaSectionOrBlockOnly
description: Identifies schema tags outside section and block files.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/schema-section-or-block-only
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/schema-section-or-block-only.md
api_name: liquid
---

# SchemaSectionOrBlockOnly

Identifies `{% schema %}` tags in files where schemas aren't valid. Theme Check reports a schema tag unless it's in a section or block file.

Schema tags define settings for sections and blocks only. Keep schema tags out of templates, snippets, layouts, and other theme files.

***

## Examples

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

### ✗ Fail

In the following example, `templates/index.liquid` contains a `{% schema %}` tag:

## templates/index.liquid

```liquid
{% schema %}
{
  "name": "Home page"
}
{% endschema %}
```

### ✓ Pass

In the following example, `sections/hero.liquid` contains a `{% schema %}` tag in a section file:

## sections/hero.liquid

```liquid
{% schema %}
{
  "name": "Hero"
}
{% endschema %}
```

***

## Options

The following example contains the default configuration for this check:

```yaml
SchemaSectionOrBlockOnly:
  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 SchemaSectionOrBlockOnly %}
{% schema %}
{
  "name": "Home page"
}
{% endschema %}
{% # theme-check-enable SchemaSectionOrBlockOnly %}
```

***
