Jekyll add category list in archives
11 Mar 2014
Archives 页面显示是所有文章的列表, 想把每个分类目录的文章列表也专门显示出来。
首先需要在文章的 Meta 信息里指定目录:
category: "测试分类目录" 然后这个分类目录名就是"测试分类目录"。
然后在archives模板增加:
(把里面的反斜线都去掉,这里为了防止被解析,不知道如果禁止文章里的模板语句被解析,囧!)
{% for category in site.categories %}
-
{\% for posts in category %}
{\% for post in posts %}
{\% if post.url %}
- {\{ post.title }} {\% endif %} {\% endfor %} {\% endfor %}
参考了Jekyll文档:
Variables Templates