Not a developer? Go to MovableType.com

Documentation

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>
Back

Leave a Comment