Movable Type Enterprise Documentation

« MTEntryIfTagged | Up | MTTagName »

Chapter Entry Tags

MTTags

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

Attributes

  • sort_by - Specifies the attribute on which to sort the select tag list. Recognized values are "id", "name" and "count." The default is "name."
  • sort_order - Specifies the order by which to sort the selected tags. Recognized values are "ascend" and "descend." The default is "descend."
  • limit - Limits the number of selected tags that are returned to the specified value. Recognized values are positive integers. The default is not to limit the selection.

These allow you to select a subset of a blog's tags when using the MTTags template element. All three attributes are optional.

Example code

To display the first 100 entry tags created on a weblog with oldest first:

<MTTags sort_by="id" sort_order="ascend" limit="100">
...
</MTTags>

To display the latest 100 entry tags created on a weblog with most recent first:

<MTTags sort_by="id" sort_order="descend" limit="100">
...
</MTTags>

To display most used 100 entry on a weblog from the most to least user:

<MTTags sort_by="count" sort_order="descend" limit="100">
...
</MTTags>

Note

Some users may want to select the N most used tags on a weblog but sort them by name, id or something other than the count. This cannot be done purely with template tags but could be done either with PHP or a sorting plugin.

Optional attributes

  • glue - A text string that is used to join each of the items together. For example <MTTags glue=", "><$MTTagName$></MTTags> would print out each tag name separated by a comma and a space.

Example code

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>
    <MTTags>
    <li>
        <a href="<$MTTagSearchLink$>"><$MTTagName$></a>
    </li>
    </MTTags>
</ul>

Using tags like MTTagRank and MTTagCount, you can make this simple code into a powerful looking and useful "tag cloud".

See Chapter 8 in the Users and Administrators Guide entitled "Customizing Your Published Weblogs" for more examples related to entry tags, including the creation of "tag clouds".

You can download the Users and Administrators Guide here.

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated; but please do not use the feedback form to submit support requests or question. We will not respond to or publish such queries submitted through this form. If you have a technical question or problem, visit Movable Type Enterprise Support.

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.