Note: CogDogBlog has a new WordPress powered home at http://cogdogblog.com/. All entries from this version have been moved there, so as a guide dog service try finding this article in its new home by title search.
More changes I forgot in the MovableType structure of CDB. Previously, when I had a poor grasp on MT templates, I had separate index templates for each of my category RSS feeds, thinking there was not a way to generalize that. This was sloppy, requiring new templates for every category I decided to add, and the more index rebuilds you ask MT to do, it seems to get a bit clunkier.
Here is how I created generalized RSS feeds (okay, they are still RSS 1.0, but I've yet to figure out why I need 2.0 or pie or Atom or whatever else it is called these days. I am open to having my paw slapped)...
You create the templates for your MT archives RSS feeds not in the top sections, the index templates (leave the RSS feed there for your overall site), but in the second block of templates, Archive Related Templates.
First, follow the link to "Create a New Archive Template". I called mine Category RSS 1.0 but it would not make a hill of bean difference if you named it Barney Rubble. It is more or less a copy of the out of the box RSS 1.o index template, with a few substitutions noted below:
<?xml version="1.0" encoding="<$MTPublishCharset$>"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:cc="http://web.resource.org/cc/" xmlns="http://purl.org/rss/1.0/"><channel rdf:about="<$MTBlogURL$>"><title><$MTBlogName encode_xml="1"$>: <$MTArchiveTitle$></title><link><$MTBlogURL$>archives/<$MTArchiveCategory dirify="1"$>.html></link><description>CDB Latest on <$MTArchiveTitle$></description><dc:language>en-us</dc:language><dc:creator></dc:creator><dc:date><MTEntries lastn="1"><$MTEntryDate format="%Y-%m-%dT%H:%M:%S" language="en"$><$MTBlogTimezone$></MTEntries></dc:date><admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=<$MTVersion$>" /><MTBlogIfCCLicense><cc:license rdf:resource="<$MTBlogCCLicenseURL$>" /></MTBlogIfCCLicense><items><rdf:Seq><MTEntries lastn="15"><rdf:li rdf:resource="<$MTEntryPermalink encode_xml="1"$>" /></MTEntries></rdf:Seq></items></channel><MTEntries lastn="15"><item rdf:about="<$MTEntryPermalink encode_xml="1"$>"><title><$MTEntryTitle encode_xml="1"$></title><link><$MTEntryPermalink encode_xml="1"$></link><description><$MTEntryExcerpt encode_xml="1"$></description><dc:subject><$MTEntryCategory encode_xml="1"$></dc:subject><dc:creator><$MTEntryAuthor encode_xml="1"$></dc:creator><dc:date><$MTEntryDate format="%Y-%m-%dT%H:%M:%S" language="en"$><$MTBlogTimezone$></dc:date></item></MTEntries></rdf:RDF>;
All I have done is used the <$MTArchiveTitle$> tag to pull out the name of the archive (as defined in the attributes section of each category you define in MT) to make the title and description relevant to the category, as well as pulling out the link to the category archive-- in this example, the archives are based on the name of the archive and referenced inside my "archives/" directory, so "Objects" category would reference the archive template created in:
your naming scheme may be different. The point here is that used in the context of a Category Archive template, the various <$MTArchiveXXX$> tags will pull out the necessary information for the context of each category you define.
So you create the general template, but you are not done. Next you must go to the WebLog Config panel, and click the Archiving link. Under "Archive Type" at the bottom click "Add new..." This brings a popup menu, where you should select under "Archive Type" (top menu) Category Archive and under the "Template Menu" select the name of the new template you created above, e.g. Category RSS 1.0.
Click the "Add" button and this new entry should be added to your last set of Category archives (this one should not be selected by the radio buttons; that ons is the template for your category web page). There is one more thing to do- in the empty field under Archive File Template, you can again use MT tags to intelligently name your RSS files, e.g. mine are:
which converts the name of every category archive I created to a web friendly file name, e.g.
the objects categoryu archive has its rss feed:
and the "web bad dog" archive has an rss feed of:
The beauty here is that if I add new categories, or change the names, etc, and rebuild, all my category RSS files are changed automatically.
Again, you have to Rebuild all of your category archives to see the changes.
Templates = power.
blogged January 12, 2004 08:12 PM
:: category [