Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图弄清楚如何显示一个类别(或全部)中的帖子总数。我设想如下所示,但无法完全弄清楚。我错过了文档中的某些内容吗?
{% for post in site.categories.CAT %} ...do some counting {% endfor %} posts: {% number_of_posts %} {% for post in site.categories.CAT %} {{ post.title }} {% endfor %}
# all posts {{ site.posts | size }} # posts in one category {{ site.categories.CAT | size }}
{% for post in site.categories.CAT %} {% capture post_count %} {{ post_count | plus: 1 }} {% endcapture %} {% endfor %} {{ post_count }}