Files
felixfoertsch.de/Content/Archive/220123-ff.de v10 felixfoertsch.github.io/_includes/post-meta.html
T

34 lines
1.1 KiB
HTML

<div class="card-subtitle mb-2 text-muted">
{% if include.post.last_modified_at %}
<span class="">{{ include.post.date | date: "%Y-%m-%d" }}</span> &bull;
<span class="">{% octicon sync height:12 class:"" %} Updated: {{ include.post.last_modified_at | date: "%Y-%m-%d" }}</span>
{% else %}
<span class="">{{ include.post.date | date: "%Y-%m-%d" }}</span>
{% endif %}
<span class="post-categories">
{% for category in include.post.categories %}
&bull;
{% 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 %}
<a href="{{ category_page.url | relative_url }}">{{ category_page.title | default: category_page.category }}</a>
{% else %}
{{ category }}
{% endif %}
{% endfor %}
</span>
</div>