Like a lot of Jekyll work, the answer is to loop through stuff way more than you think you should :)
Just loop through all categories or tags or whatever for your entire site, and use an if
tag to avoid outputting ones that this post doesn't have.
Then inside the loop body, loop through every post on your site, using if
tags again to avoid outputting the ones that don't have the category.
Here's some code that will do it for tags, I think if you replace tags
with categories
it'll work the same. I've lightly modified it from my own site, sorry if there's a typo or two:
{% for topic in site.tags | sort_by:topic order:ascending %}
{% if topic == whatever_topic_you_have %}
<section class="topic">
<h1><a name="{{ topic }}">{{ topic }}</a></h1>
{% for item in site.posts %}
{% if item.tags contains topic %}
...show your post/item here...
{% endif %}
{% endfor %}
</section>
{% endif %}
{% endfor %}