-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-meta.html
executable file
·29 lines (27 loc) · 958 Bytes
/
post-meta.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<div class="post-meta">
<span class="post-date">{{ include.post.date | date_to_string }}</span>
<span class="post-categories">
{% 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 %}
<a href="{{ site.baseurl }}{{ category_page.url }}">
{{ category }}
</a>
{% else %}
{{ category }}
{% endif %}
{% endfor %}
</span>
</div>