Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

Bought Jack McDade's course on design. Going through it now...and it is SO well done!

— Justin Jackson, Transistor.fm

Partial:Exists Tag

Checks if a partial exists.

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

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

string

You can pass the name of the partial with a parameter instead of tag argument. Example: src="cards/author_bio" or :src="var_name".

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →