Excluding Categories in Movable Type
We wanted to be able to post "draft" weblog articles, accessible for review by a selected audience but not publicly available to the world yet. We wanted to exclude one or more named categories from all indexes and lists; however, we also wanted to ensure that the "excluded" articles could be found by direct URL to their "Individual Archive" pages.
We use Movable Type which has many useful plugins available, including quite a few choices for handling categories. That's the good news.
The bad news is that none of the category plugins handles every case. We succeeded, but it took several plugins to do it. We installed:
- MTCatEntries displays entries including or excluding categories you specify. In addition to allowing you to exclude categories, CatEntries correctly displays N entries when given a lastn="N" attribute.
Note: MTCatEntries does not recognize your preferences for how many entries to show. You must specify this quantity by either number (lastn) or days, even if you weren't specifying for MTEntries.
- MTFilterCategories Allows for easy filtering of category listings to include or exclude certain categories. Not for MTEntries containers.
- Compare Plugin implements a set of template tags for displaying a portion of a template conditionally, depending on the results of a comparison between values. We're using the MTIfNotEqual tag.
Code SamplesThe snippets below cause exclusion of any postings in categories Drafts or Private from the current list or index. When you want to publish an article to the world, just change the category and rebuild your indexes.Keep in mind that these samples are snipped from my templates; your version may vary. Main Indexplugin: MTCatEntries
replace <MTEntries> ... </MTEntries>example: <MTCatEntries exclude="Private,Drafts" lastn="5"> ... </MTCatEntries> Main Indexplugin: MTFilterCategories
Insert <MTFilterCategories ...> ... </MTFilterCategories>example: <div class="sidetitle"> Categories </div> <div class="side"> <MTCategories> <MTFilterCategories exclude="Drafts|Private"> <a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a><br> </MTFilterCategories> </MTCategories> Date-Based Archiveplugin: Compare Plugin (MTIfNotEqual)
Insert <MTIfNotEqual ...> ... </MTIfNotEqual> example: <MTEntries> <MTIfNotEqual a="[MTEntryCategory]" b1="Drafts" b2="Private"> <$MTEntryTrackbackData$> <MTDateHeader> ... </MTIfNotEqual> </MTEntries> Master Archive Indexplugin: MTCatEntries
replace <MTEntries> ... </MTEntries> example: <H2>Past Entries (reverse chronological order)</H2> <MTCatEntries exclude="Private,Drafts"> <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a><br /> </MTCatEntries> |
