Jekyll display posts by category

jekyll posts
jekyll filter posts by category
jekyll tags
jekyll link to post
jekyll posts index
jekyll collection categories
categorize posts jekyll
jekyll _posts folder

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't figure out what it should be. Any ideas? Thanks!

{% for category in site.categories %}
    <h3>{{ category | first }}</h3>
    {% for post in page.categories.category %}
      {{ post.title }}<br>
    {% endfor %}            
{% endfor %}

Got it! Needed an intermediate posts loop before listing out individual posts

<ul>
{% for category in site.categories %}
  <li><a name="{{ category | first }}">{{ category | first }}</a>
    <ul>
    {% for post in category.last %}
      <li><a href="{{ post.url }}">{{ post.title }}</a></li>
    {% endfor %}
    </ul>
  </li>
{% endfor %}
</ul>

Posts, Categories and Tags​​ Jekyll makes the categories available to us at site. categories . Iterating over site. categories on a page gives us another array with two items, the first item is the name of the category and the second item is an array of posts in that category. Jekyll has first class support for categories and tags in blog posts. The difference between categories and tags is a category can be part of the URL for a post whereas a tag cannot. To use these, first set your categories and tags in front matter:

fyi, if anyone wants to just list the posts in one category, this works (differs from above example as the category returns a list of posts...

<p>Posts in category "basic" are:</p>

<ul>
  {% for post in site.categories.basic %}
    {% if post.url %}
        <li><a href="{{ post.url }}">{{ post.title }}</a></li>
    {% endif %}
  {% endfor %}
</ul>

Category page - need a page with a link to all posts of a , I have followed the steps at: https://kylewbanks.com/blog/creating-category-​pages-in how to get jekyll to create the categories page(s) (i.e. /blog/category/​sport,  Display categories on Jekyll posts. It is better to show the categories to which the current article belongs to. And upon clicking any of the categories, users should land on the page we created in the previous step.

3 Simple steps to setup Jekyll Categories and Tags, The idea is to display the most recent posts under the same category, without displaying the post currently being read. In my post layout, I added  jekyll subcategories (4) 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't figure out what it should be. Any ideas? Thanks!

<h5>Categories</h5>
{% for category in site.categories %}
    {% assign cat = category[0] %}
    <h6><a href="#">{{ cat }}</a></h6>
    {% for post in site.categories[cat] %}
        <a href="{{ post.url }}">{{ post.title }}</a> <small>{{ post.date }}</small>
    {% endfor %}
{% endfor %}

Creating Category Pages in Jekyll without Plugins, Overview. We can iterate over site.categories , each item is an array with two elements. The first element in the array is the category name, the second element is  Once your posts are categorized, you should be able to run your site and go to /category/<category name> and see each of the posts under that category! Related Posts. One of the primary reasons I wanted to implement categories was to display related posts for each blog post on the site. The idea is to display the most recent posts under the same category, without displaying the post currently being read. In my post layout, I added the following:

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 %}

List posts by category, Jekyll: List all categories with according post count and show and link all post items listed in Thanks , but I cant slide categorie posts when I click a categorie. Jekyll provides native support for categories and tags. Although the method described here is still valid, but the native method is recommended. This blog currently is using the natively supported method. Click here to see the source code for this blog. To see the code for the method described in this post, click here.

Jekyll: List all categories with according post count and show and , If the post has more than one category, we want to create a list for each category. We don't want to show the list if there is only one post in the  How do I create an IF ELSE statement if there are no Jekyll posts in a category? posts in jobs I would like to display a "We're not posts by category in Jekyll.

Jekyll: Create a list of all posts in the same category, On clicking a button, call a function that iterates through all site posts. If the clicked category appears in a given post's list of categories, display  In addition to any collections you create yourself, the posts collection is hard-coded into Jekyll. It exists whether you have a _posts directory or not. This is something to note when iterating through site.collections as you may need to filter it out.

Filtering Blog Posts by Category With Jekyll, How to generate a list all the tags on your website. A tag cloud could be created by using the number of posts and CSS. How to get the number of  I'm having trouble figuring out how to sort the content of a collection by category. I've found a very similar question on how to sort posts by category but it doesn't seem to work with collections Jekyll display posts by category.

Comments
  • I have test in my local and found the first of {{ posts }} is the category name and will be a empty line in html, so I add {% if post.url %} ahead <li><a href="{{ post.url }}">{{ post.title }}</a></li> to remove category line
  • hey, thanks for this, it works great! I have a question though (sorry, total jekyll noob) and probably would help improving your answer: do you know (if possible) how to put this code in a page that sits in /category/<name>, reads the <name> from the url and pulls the list of posts accordingly? (edit) my question dups here: stackoverflow.com/questions/25958652/…
  • This is a better answer and avoids the suggested hack that the accepted answer makes necessary.
  • Not working. Reads {% for post in site.categories[cat_name] %}