MissingTemplate
Identifies when a resource is referenced using a render
, section
, or include
tag, but doesn't exist.
The following examples contain code snippets that either fail or pass this check.
In the following example, there is no corresponding snippet-that-does-not-exist
file in the theme:
In the following example, article-card
exists in the snippets
directory of the theme:
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. |
ignore
and ignore_missing
Anchor link to section titled "ignore and ignore_missing"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:
Auto-correction
Anchor link to section titled "Auto-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.
The following example contains the default configuration for this check:
Parameter | Description |
---|---|
enabled |
Whether this check is enabled. |
severity |
The severity of the check. |
Disabling this check
Anchor link to section titled "Disabling this check"Disabling this check isn't recommended.