Sheath rule
statamic-resource-exists
#Why
Many Statamic tags resolve handles through project repositories and registries. A missing collection, taxonomy, form, route, or other literal target produces an empty result or runtime failure.
#Examples
#Bad
{{-- missing_collection is not defined by the project. --}}
<s:collection from="missing_collection" />
#Good
{{-- articles is a project collection. --}}
<s:collection from="articles" />
{{-- Fluent and @tags calls resolve the same project resources. --}}
{{ Statamic::tag('collection')->from('articles') }}
@tags(['articles' => ['collection' => ['from' => 'articles']]])
#Resources
The rule resolves literal references to project resources including collections, taxonomies, forms, navigations, asset containers, sites, dictionaries, search indexes, OAuth providers, user groups, roles, permissions, and named routes.
Tag-specific filters are included where they select another resource. Examples include collection sites, taxonomy collections, asset collections, and mount URL sites.
#Notes
Pipe-delimited resource lists report each proven missing item when the tag supports a list. Supported wildcard values are not treated as missing handles.
Dynamic values, opaque attributes, and context-dependent helpers are skipped. References on self-closing core tags that Statamic removes during compilation are not checked.
#See Also
Related documentation covers partial views and required selectors:
- statamic-partial-exists: Check partials through the Laravel view finder
- statamic-required-tag-parameter: Require inputs before resolving them
- statamic-assets-path-requires-container: Require an asset source for path queries