Hajime Fujimoto, well-known MT master in Japan, had wrote about the way of using module template for a "archive mapping".
With his method, you can define complex conditional archive mapping in the archive template.
I will introduce his entry with some modification.
At first, let's say that;
*Blog id is no.1
* The blog has "news" category and "products" category at the top level, and they have descendant categories with each.
*You want to set your archive pass like "http://www.sample.com/news/subcategories/year/month/day/%h%m%s.html" when it belongs to "news" category.
*You want to set your archive pass like "http://www.sample.com/products/subcategories/arbitrary-name.html" when it belongs to "products" category.
*Every entry belongs to only one category.
Okay, let's make a module template named "orginal-archive-pass" and write as this.
<MTUnless regex_replace="/\s+\n/g","\n">
<mt:EntryCategories>
<mt:IfIsDescendant parent="news">
<$mt:FileTemplate format="%c/%y/%m/%d/%h%n%s%x"$>
</mt:IfIsDescendant>
<mt:IfIsDescendant parent="products">
<$mt:FileTemplate format="%c/%b%x"$>
</mt:IfIsDescendant>
</mt:EntryCategories>
</MTUnless>
Then, please indicate the module template in your archive mapping form.
<mt:Include module="original-archive-pass" blog_id="1">
The file name of entries will be determined by conditional branching defined in "original-archive-pass" template.
Please give it a try.

Leave a comment