<mt:AssetIfTagged>

This template tag evaluates a block of code if a tag has been assigned to the current asset 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:AssetIfTagged tag="Foo">
    This asset has the tag "Foo"
</mt:AssetIfTagged>

Check if any tags are assigned to the asset…

<mt:AssetIfTagged>
    This asset has tags
</mt:AssetIfTagged>

Context

Attributes

tag=”foo”

If present, the template tag will evaluate if the specified tag is assigned to the current asset.

include_private=”0”

Include private tag if “1” is set.

Example

Conditional if tagged “Foo” or not:

<mt:AssetIfTagged tag="Foo">
    <!-- do something -->
<mt:Else>
    <!-- do something else -->
</mt:AssetIfTagged>

Condition based upon if a asset is tagged with the private tag @draft:

<mt:Assets>
    <li class="asset <mt:AssetIfTagged tag="@draft">draft</mt:AssetIfTagged>">
        <a href="<$mt:AssetURL$>"><$mt:AssetLabel$></a>
        <mt:AssetIfTagged tag="@draft">(draft)</mt:AssetIfTagged>
    </li>
</mt:Assets>

Bugs

This page was last updated on 2010-05-06, 03:25.

1 Note

Very good your example here is exactly the information Ive been searching the web for over half and hour.

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.