NOTE: This documentation is for Movable Type 3.2. If you are using a newer version, please see the documentation for Movable type 3.3x or Movable Type Enterprise.
Categories provide an alternate means to the weblog's traditional chronological form of organizing entries. Movable Type allows you to enter a list of categories using a variety of methods and assign one or more to each of your entries. You can use MT's categorization facilities to group related entries despite chronology or simply as a means of filtering entry listings in the CMS more easily.
Each entry can be assigned one primary category and any number of secondary categories. The primary category is used when you wish to display information about just one of the categories to which an entry is assigned. Secondary categories cast a wider net and allow entries to span classification. The difference between primary and secondary categories is one not of ranking but rather of usage. Your secondary categories are not necessarily "lesser" or "lacking in importance" when compared to your primary category.
As of version 3.1, Movable Type categories may also be given a hierarchical structure using subcategories. For example, if you have two categories, Books and Music, you may now create a new category, Entertainment, which contains both of these. Entertainment is considered the parent category of the Books and Music categories.
The Categories Listing screen is used to create, edit and manage all weblog categories. This screen is also used to assign their positions in the subcategory hierarchy.
1 Create new top level category. A link to create a category with no parent.
2 Categories. A list of category names linked to their respective Edit Category screens and indented to denote their assignments in the hierarchy.
3 Create Action. A link to create a new category with the associated category as its parent.
4 Move Action. A link that enables the associated category's parent to be changed.
5 Entries. The number of entries linked to a pre-filtered Entry Listings screen.
6 TrackBacks. The number of category pings linked to a pre-filtered TrackBack Pings Listing screen. .
I think some recommendations on when its a good idea to use subcategories is in order as they add complexity. Does 6A have anything "official" on this?
I think the average user, without a tutorial on hierarchical structures, will not be able to understand or follow subcategories. Thoughts?
The subcategory tag naming is atrocious. Can we create some aliases and deprecate the poorly named tags?
You want to create a category or subcategory to assign entries to.
Use the Create action on the Category Listings screen.
Creating a category is a quick and easy affair. Before you can begin, you must check that you have Edit Categories permission for the weblog.
Begin with the Category Listing and click the "Create new top level category" link. To create a subcategory, click the "Create" link next to the parent category.
If you are making a new entry and need to create a new category, Movable Type provides a shortcut in the Primary Category pulldown menu. Select the Add new category... option at the end of the list. This will automatically open a pop-up window where you can enter the category label and associate it with a parent category.
Depending on your display options, the Primary Category pulldown menu may not be visible on your New/Edit Entry Screen. See "Customizing the Edit Entry Screen" for how to customize your display of this page.
To define a description for the category, enter the Category Listing and click on the category's title. This will open the Edit Category Screen which allows you to enter a description. In this screen you can also rename a category and set its TrackBack options. For more on the TrackBack options, see "Enabling a Category as a TrackBack repository" and "Sending a TrackBack automatically based on an entry's category".
You need to display category data in your published pages.
Use the template tags prefixed with MTCategory.
Category tags can be used to display a list of categories and their
information in both hierarchical and non-hierarchical forms. These tags can
be used in MTArchiveList archive_type="category",
MTEntryCategories, MTCategories or
MTSubCategories tag contexts. Category tags may also be used
anywhere in a Category Archive template.
The basic tags when working with non-hierarchical data are as follows. (For an exhaustive list of Category tags see Appendix A.)
MTCategories [show_empty="1"]
A container tag that loops through the list of categories in your
weblog. The optional show_empty attribute forces a category to
be displayed even if no entries have been assigned to it. Without it only
categories with a count of one or more will be displayed. This list of
categories is created without consideration to their hierarchy.
MTCategoryLabel
The category title.
MTCategoryArchiveLink
A link to the archive page for this category. Unless category archives have been enabled, this tag may not be used and will result in an error.
MTCategoryCount
The number of entries in this category.
Here is a sample layout that produces an unordered list of category titles with their count in parenthesis.
<ul>
<MTCategories show_empty="1">.
<li><a href="<$MTCategoryArchiveLink$>">
<$MTCategoryLabel$></a> (<$MTCategoryCount$>)</li>
</MTCategories>
</ul>
The MTCategories tagset produces output for each category
without respect to its placement in the hierarchical structure.
The hierarchical structure of categories can be reflected in a template as well. Producing hierarchical category layouts requires the use of a more complex set of tags and interactions.
In MTCategories the example layout has one category where
this block is repeated for each. This behavior is similar to that of
tagsets such as MTEntries and MTComments.
However, category hierarchies where any category can have additional,
associated child-categories is not allowed. For this MT uses a technique
called recursion, where the layout is repeated inside of itself.
Here are a few of the many tags used to display and interact with these hierarchical category structures.
MTSubCategories
A container tag similar to MTCategories except that it
respects the hierarchical structure.
MTSubCatIsFirst
A conditional tag that displays its contents only during the first
MTSubCategories loop.
MTSubCatIsLast
A conditional tag that displays its contents once the last
MTSubCategories loop has been reached.
MTSubCatsRecurse
The point where a list of children should be displayed using exactly the
same format defined in MTSubCategories.
Let's look at an example. The following will produce nested, unordered lists that display the category hierarchy:
<MTSubCategories>
<MTSubCatIsFirst><ul></MTSubCatIsFirst>
<li>
<$MTCategoryLabel$>
<$MTSubCatsRecurse$>
</li>
<MTSubCatIsLast></ul></MTSubCatIsLast>
</MTSubCategories>
In this example, MTSubCategories loops through a block of
template code. When it reaches MTSubCatsRecurse the block is
then repeated for each category for which the current category is a parent.
MTSubCatIsFirst and MTSubCatIsLast are used to
output the necessary HTML tags for displaying a hierarchical list.
You want to assign more then one category to an entry.
Follow the Assign Multiple Categories link found on the New/Edit Entry screen.
As discussed in "Posting a New Entry", you can assign a category to an entry with the Primary Category pulldown menu. Assigning multiple secondary categories works a bit differently.
From the New/Edit Entry screen, click the Assign Multiple Categories link under the Primary Category pulldown menu. A list will appear with the names of every category in the system. The primary category assignment will be disabled. Check the names of each category that you want to assign the entry to. Click anywhere off the list widget to close it.
Before version 3.2, users were required to save a new entry before multiple categories could be assigned. This is no longer true.
You want to delete one or more categories.
Use the delete action on the Category Listings screen.
Click the Categories button in the Weblog Toolbars. (Note that if you do not have Edit Categories permission, Categories will not be listed in the toolbar.) Check the entries to be deleted and then click the Delete button.
Deleting a category will not remove entries assigned to the category. Only the association is permanently deleted.
You want to reorganize the category assignments of entries en masse.
Use the Power-Editing mode to change the primary category assignments as needed.
As your weblogs evolve over time, a reorganization of category assignments may eventually be necessary. A good way to handle such a reorganization is with the Power-Editing tools that can be accessed from the Entries Listing. Using this tool you can view all entries as editable records and change their primary categories. This technique only works for category assignments designated as primary. Adjusting secondary category assignments can be done using the Entries Listing category filter to get a list of any assigned entry and manually editing each. Another more automated option for developers is to use the Movable Type API to manipulate the data directly.