上次我在给“Movabletype Individual Entries RSS 的制作”中提到 给Movabletype 也能实现给每个 Category 添加一个 RSS 。现在我们来完成这个任务:
1、进入 MT 的 Templates 菜单,选择 Movabletype 提供的 RSS 模版,如:RSS 2.0 Index。进入编辑模式后,复制下所有内容(template body)。
2.、回到 Templates 菜单,进入“汇整相关模版 (Archive) ”栏目,选择 Create new archive template (如果你用的是中文。 进入增加模式后,你可以给新模板取一个名字,例如“Category RSS”,然后粘贴刚才Copy 的代码。最后按“保存(Save)”按钮。
3.、点击 MT 的 Weblog Config 菜单(中文的“核心设定”)。选择 “Archive Files”,在“Create A New Template/Archive Type Association”处,“Archive Type”选择 “Category(类别)”,在 Template 处选择刚才的“Category RSS”,然后按 “加入(Add)” 按钮。
4、这时,在下面的 Category(类别)处,在原有的“Category Archive”下会多出一个 “Category RSS”, 在右边的文字栏中(即 Archive File Template / 汇整档案模板) 加入以下 code 来指定输出 RSS 的文件名:
%c/index.xml或者<MTArchiveCategory dirify="1">.xml
最后按保存按钮。
5、重建你的 weblog, 此时就会在你的相关文档下面建立你每个 category 的 xml 文档。
6、你可以使用以下代码来输出你的 Category RSS 的地址:
<MTCategories>
<a href="<MTBlogArchiveURL><MTCategoryLabel dirify="1">.xml">
<MTCategoryLabel></a></MTCategories>
但这样定位对一些二级分类则无效果。建议使用下面标签进行定位:
<MTEntries lastn="1"><MTEntryCategories>
<a href="<$MTCategoryArchiveLink$>index.xml"><$MTCategoryLabel$>
</a></MTEntryCategories></MTEntries>

Add a Reply