Overview
You can use this tag to check if a partial exists. Useful if you have some sort of dynamic loop.
{{ if {partial:exists src="mypartial" } }} It exists{{ else }} It doesn't.{{ /if }}
@if (Statamic::tag('partial:exists')->src('mypartial')->fetch()) It exists@else It doesn't.@endif
Related Reading
This tag goes hand in hand with the partial
tag.
You may be interested in the partial:if_exists
tag to simplify your template.
Parameters
src
You can pass the name of the partial with a parameter instead of tag argument. Example: src="cards/author_bio"
or :src="var_name"
.