MissingTemplate
Identifies when a resource is referenced using a render
, section
, or include
tag, but doesn't exist.
Anchor to ExamplesExamples
The following examples contain code snippets that either fail or pass this check.
Anchor to ✗ Fail✗ Fail
In the following example, there is no corresponding snippet-that-does-not-exist
file in the theme:
Anchor to ✓ Pass✓ Pass
In the following example, article-card
exists in the snippets
directory of the theme:
Anchor to OptionsOptions
Parameter | Description |
---|---|
enabled | Whether this check is enabled. |
ignore | A list of files to ignore instances of missing templates within. |
ignore_missing | A list of patterns of missing template files to ignore. |
The ignore
option instructs Theme Check to ignore all occurrences of MissingTemplate
according to the file in which they appear.
For example, using the following setting, Theme Check ignores all MissingTemplate
errors in templates/index.liquid
, no matter the file being rendered:
The ignore_missing
option instructs Theme Check to ignore all occurrences of MissingTemplate
based on the target template being rendered.
For example, using the following setting, Theme Check ignores offenses on {% render 'icon-missing' %}
across all theme files:
Anchor to Auto-correctionAuto-correction
Theme Check can correct this error using the --auto-correct
flag. When the flag is specified, Theme Check creates missing resources referenced using an include
or render
tag in the snippets
directory, and creates missing resources referenced using a section
tag in the sections
directory. These resources are created as empty Liquid files.
Anchor to OptionsOptions
The following example contains the default configuration for this check:
Parameter | Description |
---|---|
enabled | Whether this check is enabled. |
severity | The severity of the check. |
Anchor to Disabling this checkDisabling this check
Disabling this check isn't recommended.