diff options
author | EuAndreh <eu@euandre.org> | 2020-10-10 22:42:44 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-10-10 22:50:17 -0300 |
commit | 9b6e0c8cfa89eb5073e19c9fdc7c912b82a5fcec (patch) | |
tree | 167f018af5ad97a5c7227a16c6ed39e51466f68e /_includes/categories.html | |
parent | Add initial version of the adapted presentation from remarkjs (diff) | |
download | euandre.org-9b6e0c8cfa89eb5073e19c9fdc7c912b82a5fcec.tar.gz euandre.org-9b6e0c8cfa89eb5073e19c9fdc7c912b82a5fcec.tar.xz |
Add basic categories page support
Diffstat (limited to '_includes/categories.html')
-rw-r--r-- | _includes/categories.html | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/_includes/categories.html b/_includes/categories.html new file mode 100644 index 0000000..7c91a93 --- /dev/null +++ b/_includes/categories.html @@ -0,0 +1,30 @@ +{% 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 %} + {% endif %} + {% endif %} +{% endfor %} +{% assign articles_with_categories = articles_with_categories | reverse %} + +{% assign categories = "" | split:"" %} +{% for article in articles_with_categories %} + {% assign categories = categories | push:article.category %} +{% endfor %} + +{% assign unique_categories = categories | sort | uniq %} +{% for category in unique_categories %} + <h2 id="{{ category }}"> + <a href="#{{ category }}">{{ category }}</a>: + </h2> + <ul> + {% for article in articles_with_categories %} + {% if category == article.category %} + <li> + <a href="{{ article.url | relative_url }}">{{ article.title | escape }}</a> - {% include i18n-date.html date=article.date %} + </li> + {% endif %} + {% endfor %} + </ul> +{% endfor %} |