Documentation


Template

The template plugin gives you access to template data and logic.

Not to be confused with the theme plugin, the template plugin has specific data passed to the page from PyroCMS' Template Library. This includes things like the body of the page and the title of the page.

The template plugin's slug is template, so it can be used like so:

{pyro:template:function}

Functions

{pyro:template:title}

Displays the current meta title.


{pyro:template:body}

Displays the output of the current module.


{pyro:template:metadata}

Displays the metadata for the current page. This includes javascript, css, and metadata information for the head of the HTML document.


{pyro:template:partial}

Displays a template partial that has been set in a module controller. Not to be confused with {{ theme:partial} which loads a theme partial file.

Attributes

Name Default Required Description
name None Yes Name of the template partial that you want to display.

Example:

{pyro:template:partial name="cool_partial"}
Check out this cool partial!

{pyro:template:has_partial}

Displays content if a template partial exists.

Attributes

Name Default Required Description
name None Yes Name of the partial you are checking for.

Example:

{pyro:template:has_partial name="sidebar"}
	<p>Hello admin!</p>
{/pyro:template:has_partial}

{pyro:template:has_breadcrumbs}

Check for the existence of template breadcrumbs. Returns true or false.

Parameters

Parameter Description
none This function does not require any parameters.

Example:


{{ if '{pyro:template:has_breadcrumbs}'}
<div class="breadcrumbs">
{pyro:template:breadcrumbs}
    {if '{pyro:uri}'}
        {pyro:url:anchor segments='{pyro:uri}' title='{pyro:name}'}
    {else}
        {name}
    {/if}
{/pyro:template:breadcrumbs}
</div>
{/if}