Updated August 23, 2006. Fixed a few things.
Most non-fiction books have a Subject Index in the back, making it easy for the reader to look up topics of interest, based on a word or term. With MT3.3's new tagging feature, you can create an alphabetical index of your entries tags. You can see this in action with LMT's Tag Index.
- Add tags to your posts.
In the entry edit window, click on "Customize the display of this page" link at the bottom of the page. In the popup, select "Custom" and check the box marked "Tags". Now you should see a field for tags in your entry edit window. For each entry, add a tag or tags, separated by a comma. Try to avoid odd characters like apostrophes and ampersands. Decide on a capitalization scheme (either all lower case or the first letter is caps) and stick with it. Here's an example:
Apples, James Madison, New York City
Here are some tips for successful tagging:
- Be specific. Pick words that are as specific as possible. For example "Gravenstein Apple" is more specific than "Food".
- Be consistent. If you've tagged one post "The Netherlands," avoid tagging another post "Netherlands". Check your complete tag index to see if a tag has already been used.
- Be redundant. Not every Chocolate-related post will also have Dessert as a keyword. But if at least one does, then the two subjects are related.
- Tag all your posts, including your old posts. (If you have been using keywords as a way of tagging see Converting Keywords into Tags.)
- Make a new tag-only search results template.
By default, MT3.3 uses the default Search Results Template (in System Templates) for tag results. So when you click on a tag displayed in an entry it triggers the mt-search.cgi script and a search result page is displayed with the titles and excerpts of the entries with that tag. You will want to create a tag-only search results template. The way to do that is to create an "Alternative Search Template". To do this, see the directions in the LMT tutorial MT Keyword Search. You can copy the default search template from Templates > System Templates. Paste it into a text editor and make adjustments on this template. Follow the directions in LMT for creating an alternate search template or the directions in the MT User Manual for Adding Alternate Search Templates.
My basic tag search result template looks something like this in the main section:
- Create an index of all of your tags.
Create a new index template. Set the template to rebuild automatically. Copy and paste everything from your main index into the new template. Delete everything in the middle section of the template that has to do with entries (everything between and including the
MTEntriesopening and closing tags). In its place put the following code:
<h3 class="title">Index</h3> <MTTags> <li> <a href="<$MTCGIPath$>mt-search.cgi?tag=<$MTTagName$>&Template=the_name_of_your_tag_search_template&blog_id=<$MTBlogID$>"><$MTTagName$></a> (<$MTTagCount$>) </li> </MTTags>
- Display tags in your entries.
MTEntriesopening and closing tags on the Main Index and Archive templates, you can put the following code to list out the tags for the entry:
<MTEntryIfTagged> Tagged: <MTEntryTags glue=", "> <a href="/path/to/MT/mt-search.cgi?tag=<$MTTagName$>&Template=the_name_of_your_tag_search_template&blog_id=1"><$MTTagName$></a> </MTEntryTags> </MTEntryIfTagged>
Remember to swap out the path to your MT install, the tag search template, and the blog ID as in the previous step.
Many thanks to Mike Everett-Lane for the inspiration for this article.
Everybody Loves Tags!