user-pic

Movabletype 全部文章按分类汇总

Vote 0 Votes

案例:http://mtblog.org/categorys.html

我简单的修改了下全部文章汇总页面,将其改为按按类和按月分。
其中类别分类的主体效果如下:
A分类:
 A中文章1
 A中文章2
B分类:
 B中文章1
 B中文章2 

制作方法:
进入Master Archive Index 也就是archives.html模版。当然你也可以创建一个新的首页模板保留原有的Master Archive Index模版。将其中的主体部分的如下代码:

<div class="archive-date-based archive">

<div class="archive-content">
<ul class="archive-list">
<MTArchiveList archive_type="Individual">
<li class="archive-list-item"><$MTArchiveDate format="%Y.%m.%d"$>: <a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a></li> </MTArchiveList>
</ul>
</div>
</div>
替换为下面的代码:

<div class="archive-date-based archive">
<div class="archive-content">

<MTCategories>
<$MTCategoryLabel$><br />
<MTEntries>
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a><br />
</MTEntries>
</MTCategories>

</div>
</div>
这样,就在每个类别下显示了该类别的所有文章。若你只要在每个类别中显示5篇,那就把 <MTEntries> 改为 <MTEntries lastn="5">,在末尾添加个“更多”连接到相关类别。
也就是在页面中使用这段代码:

<MTCategories>
<$MTCategoryLabel$><br />
<MTEntries>
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a><br />
</MTEntries>
</MTCategories>

在<MTCategories>标签中包含<MTEntries>标签。

而后你可以根据本站提供的标签制作能够“按类下移”和“回到顶部”的页面
<div id="pagetop"></div>

本站共有文章 <$MTBlogEntryCount$> 篇,评论 <$MTBlogCommentCount$> 篇,点击下列分类浏览相应类别的文章:
<ul>
<li><MTCategories><a href="#<$MTCategoryLabel dirify="1"$>"><$MTCategoryLabel$></a> | </MTCategories></li>
</ul>

<MTCategories>
<div id="<$MTCategoryLabel dirify="1"$>"><$MTCategoryLabel$> | <a href="#pagetop">回到顶部</a></div>
<ul>
<MTEntries sort_order="descend">
<li><a href="<$MTEntryPermalink$>" target="_self"><$MTEntryTitle$></a>&nbsp;&nbsp;&nbsp;&nbsp;[<$MTEntryCommentCount$>/<$MTEntryTrackbackCount$>]</li>
</MTEntries>
</ul>
</MTCategories>

Add a Reply

Forum Groups

Blogcs 基于MT平台的BSP

MovableType 中文化

1 0

Last Topic: Movable Type 中文化 - 平生一笑 by bb on 2008年10月11日

1 0

Last Topic: Zhu8's Weblog:猪八的网:浮生志 by Zhu8 on 2008年10月16日

MovableType 问题咨询

Be the first to post a topic in this forum

MovableType 使用

16 11

Last Topic: Image::Magick 模块的安装 by bb on 2008年11月 9日

30 35

Last Topic: MT-Twitter:将MT文章同步到Twitter by bb on 2008年3月 9日

22 1

Last Topic: 修改MT的作者归档路径 by bb on 2008年10月25日

MovableType 模板

Be the first to post a topic in this forum

22 17

Last Topic: MovableType评论格式化 replies-to-replies by bb on 2008年10月15日

MovableType 延伸

14 17

Last Topic: 从Wordpress转移到Movabletype by bb on 2007年5月12日

2 2

Last Topic: 最新版MovableType 4.22 已经发布 by bb on 2008年11月19日