Skip to content

Instantly share code, notes, and snippets.

@daveaiello
Last active January 3, 2016 06:08
Show Gist options
  • Save daveaiello/8420199 to your computer and use it in GitHub Desktop.
Save daveaiello/8420199 to your computer and use it in GitHub Desktop.
Count and display multiple Entry Assets of the type YouTube video associated with the current entry. This is Movable Type Markup Language code to be used in conjunction with the SuperAssets For YouTube plugin, which extends the Movable Type Asset Manager.
<mt:var name="youtube_asset_count" value="0">
<mt:EntryAssets type="youtube_video">
<mt:var name="youtube_asset_count" op="++" setvar="youtube_asset_count">
</mt:EntryAssets>
<mt:Ignore>
<!-- Later in the template... -->
</mt:Ignore>
<mt:Unless name="youtube_asset_count" eq="0">
<div class="asset-list">
<mt:If name="youtube_asset_count" eq="1">
<mt:EntryAssets type="youtube_video">
<a href="http://www.youtube.com/watch?v=<$mt:AssetProperty property="youtube_video_id"$>" target="_blank">View on YouTube</a>
</mt:EntryAssets>
<mt:Else>
<h3>YouTube:</h3>
<ul>
<mt:EntryAssets type="youtube_video">
<li<mt:If name="__counter__" eq="1"> class="first"</mt:If>><a href="http://www.youtube.com/watch?v=<$mt:AssetProperty property="youtube_video_id"$>" target="_blank">Video <$mt:var name="__counter__"$></a></li>
</mt:EntryAssets>
</ul>
</mt:If>
</div>
</mt:Unless>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment