Sheath rule
statamic-assets-path-requires-container
Statamic
assets path queries must identify an asset container or collection.
#Why
A path is relative to an asset source. The core assets tag cannot resolve a
truthy path without container, handle, id, or collection.
#Examples
#Bad
{{-- path is relative, but no asset source is provided. --}}
<s:assets path="photos" />
#Good
{{-- container identifies the source of the path. --}}
<s:assets container="media" path="photos" />
{{-- Fluent calls need the same source selector. --}}
{{ Statamic::tag('assets')->container('media')->path('photos') }}
#Notes
The requirement applies to the core assets index method. Other method suffixes
are outside its scope. An empty path does not start a path query, while a bare
path is truthy.
Dynamic source values and opaque parameter maps are skipped when they may provide a usable container at runtime. Conditional component attributes are checked on each reachable render path.
#See Also
Related rules validate the selected resources and other query combinations:
- statamic-resource-exists: Verify a literal container or collection exists
- statamic-incompatible-query-parameters: Reject incompatible result controls