PageIfTagged
This template tag evaluates a block of code if a tag has been assigned to the current page in context.
If the tag
attribute is not assigned, then the template tag will evaluate if any tag is present.
Check for a specific tag…
<mt:PageIfTagged tag="Foo">
This page has the tag "Foo"
</mt:PageIfTagged>
Check if any tags are assigned to the page…
<mt:PageIfTagged>
This page has tags
</mt:PageIfTagged>
Context
Attributes
tag
If present, the template tag will evaluate if the specified tag is assigned to the current page.
include_private=”0”
Include private tag if “1” is set.
Example
Conditional if tagged “Foo” or not:
<mt:PageIfTagged tag="Foo">
<!-- do something -->
<mt:Else>
<!-- do something else -->
</mt:PageIfTagged>
Condition based upon if a page is tagged with the private tag @draft:
<mt:Pages>
<li class="page <mt:PageIfTagged tag="@draft">draft</mt:PageIfTagged>">
<a href="<$mt:PagePermalink$>"><$mt:PageTitle$></a>
<mt:PageIfTagged tag="@draft">(draft)</mt:PageIfTagged>
</li>
</mt:Pages>