<mt:Tags>

A container tags used for listing all previously assigned entry tags for the blog in context.

Attributes:

  • glue

    A text string that is used to join each of the items together. For example

        <mt:Tags glue=", "><$mt:TagName$></mt:Tags>

    would print out each tag name separated by a comma and a space.

  • type

    The kind of object for which to show tags. By default the entry tags are shown.

  • sort_by

    The tag object column on which to order the tags. Common values are name and rank. By default tags are sorted by name.

  • sort_order

    The direction in which to sort tags by the sort_by field. Possible values are ascend and descend. By default, tags are shown in ascending order when sorted by name and descending order when sorted by other columns.

  • limit

    A number of tags to show. If given, only the first tags as ordered by sort_by and sort_order are shown.

  • top

    A number of tags to show. If given, only the given number of tags with the most uses are shown. For example:

        <mt:Tags top="20">
            <$mt:TagName$>
        </mt:Tags>

    is equivalent to

        <mt:Tags limit="20" sort_by="rank">
            <$mt:TagName$>
        </mt:Tags>

    Note that even when top is used, the tags are shown in the order specified with sort_by and sort_order.

The following code is functional on any template. It prints a simple list of tags for a blog, each linked to a tag search.

    <ul>
        <mt:Tags>
        <li>
            <a href="<$mt:TagSearchLink$>"><$mt:TagName$></a>
        </li>
        </mt:Tags>
    </ul>

Using tags like TagRank and TagCount and proper page styling, you can make this simple code into a powerful looking and useful "tag cloud".

    <ul>
        <mt:Tags top="20">
        <li class="rank-<$mt:TagRank max="10"$> widget-list-item">
            <a href="<$mt:TagSearchLink$>"><$mt:TagName$></a>
        </li>
        </mt:Tags>
    </ul>
This page was last updated on 2008-01-31, 14:55.  

3 Notes

This tag supports the MultiBlog template tag attributes blog_ids/include_blogs and exclude_blogs for aggregating across different blogs.

There are a few very useful examples of more optional attributes for mt:Tags in this forum post: http://forums.sixapart.com/index.php?s=&showtopic=58686&view=findpost&p=249240

These should probably be added here at some point.

this needs an optional attribute of "name="

The current attributes are geared to tag clouds, aka "spatially relevant" but not "sequentially" relevant.

Categories could use the same optional attribute "name="

I don't always want to iterate through the list, in some cases I want to work with the tagCount.

Currently there is no way to get the number of entries in a category or tag individually. Seems simple, but I've had a hard time figuring it out of there is a combo of other blocks and attributes.

Thanks

JK

Leave a note

Have a question, please use the MT Forums. Notes sumbitted here should pertain to tips & hints regarding documentation. Your note may be removed once it's contents has be integrated into the body of the page.