While this tutorial has content that we believe is of great benefit to our community, we have not yet tested or edited it to ensure you have an error-free learning experience. It's on our list, and we're working on it! You can help us out by using the "report an issue" button at the bottom of the tutorial.

I wanted something that would show up to 5 recent posts of the same category. Jekyll has a related_posts site variable, but it filters by tags instead of categories, and it was giving me all kinds of weirdnesses. I figured out a solution with some clever use of the liquid syntax 1:


  {{ page.category }}
  
    <div class="row related-posts">
      <h2 class="text-center">More {{ page.category }} Posts!</h2>
      <div class="medium-12 small-12 columns">
        
          

           <h3>
            <a href="{{ site.url }}{{ site.baseurl }}{{ post.url }}">
              {{ post.title }}
            </a>
           </h3>



      </div>
    </div>


  1. I simplified the markup that displays each related post, just to be simpler for demonstration purposes.

0 Comments

Creative Commons License