Jekyll/Liquid Templating: How to group blog posts by year?
问题 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