Jekyll display posts by category

前端 未结 6 633
遇见更好的自我
遇见更好的自我 2020-12-07 09:28

scratching my head over this - help much appreciated.

I want to display a list of all my Jekyll posts, organised by category. I know Line 3 isn\'t correct but I can

6条回答
  •  既然无缘
    2020-12-07 10:01

    I can't recall the exact syntax off-hand but something like the following code should retrieve the category names to allow your to retrieve posts for each category...

    {% for category in site.categories %}
    
       {% assign cat_name = category[0] %}
    
      {% for post in site.categories.cat_name %}
    
           ...
    
      {% endfor%}
    
     {% endfor %}
    

提交回复
热议问题