{{ include.post.date | date_to_string }}
{% for category in include.post.categories %}
•
{% comment %}
Check if this category has a corresponding page before decide
to link to it. This is an O(n^2) operations so consider removing
it and linking for all categories (or no categories) if this
site has a lot of pages and/or a lot of categories.
{% endcomment %}
{% assign category_page = false %}
{% for node in site.pages %}
{% if node.category == category or node.title == category %}
{% assign category_page = node %}
{% endif %}
{% endfor %}
{% if category_page %}
{{ category_page.title | default: category_page.category }}
{% else %}
{{ category }}
{% endif %}
{% endfor %}