liquid

Jekyll/Liquid Templating: How to group blog posts by year?

点点圈 提交于 2019-11-26 09:19:17
问题 I\'m rewriting my blog to use Jekyll. Jekyll uses the Liquid templating language so it makes it a little more difficult to learn how to customize. I\'d like to group my list of blog posts by year. How would I write the Liquid code to be able to do this? {% for post in site.posts %} <li><!-- display post year here (but only once, per year) --></li> <li> <a href=\"{{ post.url }}\">{{ post.title }}</a> </li> {% endfor %} 回答1: If you want to break it down by year, here's the code: {% for post in

An easy way to support tags in a jekyll blog

筅森魡賤 提交于 2019-11-26 05:19:08
问题 I am using the standard jekyll installation to maintain a blog, everything is going fine. Except I would really like to tag my posts. I can tag a post using the YAML front matter, but how do I generate pages for each tag that can will list all posts for a tag? 回答1: This gist will generate a page per category for you: https://gist.github.com/524748 It uses a Jekyll Generator plugin, plus a Page subclass. 回答2: Here is a solution with alphabetically sorted tags on a single page . It uses Liquid