aboutsummaryrefslogtreecommitdiff
path: root/_layouts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-02-14 22:56:47 -0300
committerEuAndreh <eu@euandre.org>2020-02-14 22:56:47 -0300
commitbdfc3da94fa8d16873c427bd4b2c1a1d054a9183 (patch)
tree5dc27c9d33c29d92f87ece4160a84a556d66b84e /_layouts
parent_layouts/default.html: Generate langs <ul> only when there are langs (diff)
downloadeuandre.org-bdfc3da94fa8d16873c427bd4b2c1a1d054a9183.tar.gz
euandre.org-bdfc3da94fa8d16873c427bd4b2c1a1d054a9183.tar.xz
Only list posts for languages there are available
Diffstat (limited to '_layouts')
-rw-r--r--_layouts/index.html13
1 files changed, 6 insertions, 7 deletions
diff --git a/_layouts/index.html b/_layouts/index.html
index 73b97ef..037e0e3 100644
--- a/_layouts/index.html
+++ b/_layouts/index.html
@@ -2,14 +2,13 @@
layout: default
---
<h1>{{ site.t.recent_posts[page.lang] }}</h1>
-{% if site.posts.size > 0 %}
+{% assign lposts=site.posts | where:"lang", page.lang | sort: 'date' %}
+{% if lposts.size > 0 %}
<ul>
- {%- for post in site.posts -%}
- {% if post.lang == page.lang %}
- <li>
- <a href="{{ post.url }}">{{ post.title | escape }}</a> - {{ post.date | date: site.t.date_format[page.lang] }}
- </li>
- {% endif %}
+ {%- for post in lposts -%}
+ <li>
+ <a href="{{ post.url }}">{{ post.title | escape }}</a> - {{ post.date | date: site.t.date_format[page.lang] }}
+ </li>
{%- endfor -%}
</ul>
{% endif %}