title: Jekyll blog show posts under a category
body: <p>I want to show posts that are from a certain category. For example, going to url <a href="http://example.com/posts/programming" rel="noreferrer">http://example.com/posts/programming</a> will list all the posts that have "programming" as their category.</p>
  
  <p>My general blog index looks like below</p>
  
  <pre><code>  {% for post in site.posts %}
      &lt;div class="post-box"&gt;
        &lt;div class="post-title"&gt;
          &lt;a href="{{ post.url | prepend: site.baseurl }}"&gt;{{ post.title }}&lt;/a&gt;
        &lt;/div&gt;
        &lt;span class="post-date"&gt;{{ post.date | date: "%b %-d, %Y" }}&lt;/span&gt;
        &lt;p class="post-excerpt"&gt;{{ post.excerpt }}&lt;/p&gt;
        &lt;div&gt;
          {% for category in post.categories %}
            &lt;a href="#"&gt;#{{ category }}&lt;/a&gt;
          {% endfor %}
        &lt;/div&gt;
      &lt;/div&gt;
    {% endfor %}
  </code></pre>
  
  <p>If Jekyll does not automatically provide a specific url for each category, I would have to dynamically change the available posts based on the given url. I can of course create a directory dedicated to each category and then make <code>index.html</code> inside it, but there must be a better way.</p>
  
  <p>It would be perfect if there were a way to dynamically change <code>{% for post in site.posts %}</code> part to <code>{% for post in posts in some_category %}</code> with javascript. Any help would be wonderful.</p>