Not a developer? Go to MovableType.com

Documentation

CategoryNext

A container tag which creates a category context of the next category relative to the current entry category or archived category.

<mt:CategoryNext>
    <a href="<MTArchiveLink archive_type="Category">"><MTCategoryLabel></a>
</mt:CategoryNext>

If the current category has sub-categories, then CategoryNext will generate a link to the next sibling category. For example, in the following category hierarchy:

  • News
    • Gossip
    • Politics
    • Sports
  • Events
    • Oakland
    • Palo Alto
    • San Francisco
  • Sports
    • Local College
    • MBA
    • NFL

If the current category is “News” then CategoryNext will link to “Events”.

If the current category is “Palo Alto” then CategoryNext will link to “San Francisco”.

If the current category is “Sports” then CategoryNext will be empty as there is no next category. A link to the next category is not availble for the last category in a list and a link to previous category is not available for the first category.

Here’s an example showing the relationships between categories when determining mt:CategoryNext and mt:CategoryPrevious.

  • Cat 1 (CategoryNext: Cat 2)
    • Cat 1A (CategoryNext: Cat 1B)
    • Cat 1B (CategoryNext: Cat 1C, CategoryPrev: Cat 1A)
    • Cat 1C (CategoryPrev: Cat 1B)
  • Cat 2 (CategoryNext: Cat 3, CategoryPrev: Cat 1)
    • Cat 2A (CategoryNext: Cat 2B)
    • Cat 2B (CategoryNext: Cat 2C, CategoryPrev: Cat 2A)
    • Cat 2C (CategoryPrev: Cat 2B)
  • Cat 3 (CategoryPrev: Cat 2)

Attributes

show_empty

Specifies whether categories with no entries assigned should be counted and displayed.

Examples

List the previous and next for a recursive category list, showing empty categories too:

<mt:SubCategories top="1">
    <mt:SubCatIsFirst>
        <ul>
    </mt:SubCatIsFirst>
            <li>
                <a href="<$mt:CategoryArchiveLink$>" title="<$mt:CategoryDescription$>"><$mt:CategoryLabel$></a>
                <ul>
    <mt:CategoryNext show_empty="1">
                <li>CategoryNext: <a href="<$mt:ArchiveLink archive_type="Category"$>"><$mt:CategoryLabel$></a></li>
    </mt:CategoryNext>
    <mt:CategoryPrevious show_empty="1">
                <li>CategoryPrev: <a href="<$mt:ArchiveLink archive_type="Category"$>"><$mt:CategoryLabel$></a></li>
    </mt:CategoryPrevious>
                </ul>
    <$mt:SubCatsRecurse$>
            </li>
    <mt:SubCatIsLast>
        </ul>
    </mt:SubCatIsLast>
</mt:SubCategories>
Back

Leave a Comment