I want to show posts that are from a certain category. For example, going to url http://example.com/posts/programming will list all the posts that have "programming" as their category.
My general blog index looks like below
{% for post in site.posts %}
<div class="post-box">
<div class="post-title">
<a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</div>
<span class="post-date">{{ post.date | date: "%b %-d, %Y" }}</span>
<p class="post-excerpt">{{ post.excerpt }}</p>
<div>
{% for category in post.categories %}
<a href="#">#{{ category }}</a>
{% endfor %}
</div>
</div>
{% endfor %}
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 index.html
inside it, but there must be a better way.
It would be perfect if there were a way to dynamically change {% for post in site.posts %}
part to {% for post in posts in some_category %}
with javascript. Any help would be wonderful.