Skip to main content

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:

{% render 'snippet-that-does-not-exist' %}

In the following example, article-card exists in the snippets directory of the theme:

{% render 'article-card' %}

MissingTemplate:
enabled: true
ignore:
- path-to-file/filename1.md
ignore_missing:
- path-to-file/filename-*
ParameterDescription
enabledWhether this check is enabled.
ignoreA list of files to ignore instances of missing templates within.
ignore_missingA 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:

MissingTemplate:
ignore:
- templates/index.liquid

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:

MissingTemplate:
ignore_missing:
- snippets/icon-*

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:

MissingTemplate:
enabled: true
severity: error
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended.


Was this page helpful?