aboutsummaryrefslogtreecommitdiff
path: root/_includes/categories.html
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-11-14 11:03:12 -0300
committerEuAndreh <eu@euandre.org>2020-11-14 11:11:12 -0300
commit9e1e7783b385b670bec774cbad604fbf4581d079 (patch)
treeb2e27ebf3d7d2ae36a2c795a09ff617e47bea8f2 /_includes/categories.html
parentIndent code of plaintext generator (diff)
downloadeuandre.org-9e1e7783b385b670bec774cbad604fbf4581d079.tar.gz
euandre.org-9e1e7783b385b670bec774cbad604fbf4581d079.tar.xz
Use "eu_categories" frontmatter attribute
Jekyll treats names like "category" and "categories" differently, so I chose to name it "eu_categories" in order to avoid inheriting the special treatment, and have full control of what a category means and how it behaves. The _includes/category.html was changed to reflect that, with an extra coupled change that makes it not specific to articles, but any collection type.
Diffstat (limited to '')
-rw-r--r--_includes/categories.html30
1 files changed, 15 insertions, 15 deletions
diff --git a/_includes/categories.html b/_includes/categories.html
index 60a6ed6..22e5df3 100644
--- a/_includes/categories.html
+++ b/_includes/categories.html
@@ -1,18 +1,18 @@
-{% assign articles_with_categories = "" | split:"" %}
-{% for article in site.articles %}
- {% if article.lang == page.lang %}
- {% if article.category %}
- {% assign articles_with_categories = articles_with_categories | push:article %}
+{% assign entries_with_categories = "" | split:"" %}
+{% for entry in site[include.kind] %}
+ {% if entry.lang == page.lang %}
+ {% if entry.eu_categories %}
+ {% assign entries_with_categories = entries_with_categories | push:entry %}
{% endif %}
{% endif %}
{% endfor %}
-{% assign articles_with_categories = articles_with_categories | reverse %}
+{% assign entries_with_categories = entries_with_categories | reverse %}
{% assign categories = "" | split:"" %}
-{% for article in articles_with_categories %}
- {% assign article_categories = article.category | split:"," %}
- {% for article_category in article_categories %}
- {% assign categories = categories | push:article_category %}
+{% for entry in entries_with_categories %}
+ {% assign entry_categories = entry.eu_categories | split:"," %}
+ {% for entry_category in entry_categories %}
+ {% assign categories = categories | push:entry_category %}
{% endfor %}
{% endfor %}
@@ -22,12 +22,12 @@
<a href="#{{ category }}">{{ category }}</a>:
</h2>
<ul>
- {% for article in articles_with_categories %}
- {% assign article_categories = article.category | split:"," %}
- {% for article_category in article_categories %}
- {% if category == article_category %}
+ {% for entry in entries_with_categories %}
+ {% assign entry_categories = entry.eu_categories | split:"," %}
+ {% for entry_category in entry_categories %}
+ {% if category == entry_category %}
<li>
- <a href="{{ article.url | relative_url }}">{{ article.title | escape }}</a> - {% include i18n-date.html date=article.date %}
+ <a href="{{ entry.url | relative_url }}">{{ entry.title | escape }}</a> - {% include i18n-date.html date=entry.date %}
</li>
{% endif %}
{% endfor %}