Not a developer? Go to MovableType.com

Documentation

TagRank

A variable tag which returns a number from “1” to “6” (by default) which represents the rating of the entry tag in context in terms of usage where “1” is used for the most often used tags, “6” for the least often. The tag context is created by either an EntryTags or an Tags block.

This is suitable for creating “tag clouds” in which TagRank can determine what level of header (h1-h6) to apply to the tag.

Attributes

  • max (optional; default “6”): Allows a user to specify the upper bound of the scale. (Why default to “6” and not a more common number like “5” or “10”? See the example below where the TagRank tag is used to create heading HTML elements h1-h6.)

MultiBlog Attributes

This template tag supports the multiblog template tags.

Example

The following is a very basic tag cloud suitable for an index template or, with some styling, a sidebar of any page.

<h1>Tag cloud</h1>
<div id="tagcloud">
    <mt:Tags>
        <h<mt:TagRank>>
            <a href="<mt:TagSearchLink>"><mt:TagName></a>
        </h<mt:TagRank>>
    </mt:Tags>
</div>

Note that the results are not always as expected. If few tags are used frequently you may end up with many h1, h2, and h3 elements, no h4 or h5, and only one h6, for example. Or, if your tags have very little re-use, you may end up with a single h1 and many h6 elements, with nothing in between. That’s part of the excitement: to see how your tags are distributed!

Back

Leave a Comment