web/_includes/update-list.html
2021-01-26 20:24:47 +08:00

24 lines
613 B
HTML

{% comment %}
Get the last 5 posts from lastmod list.
{% endcomment %}
{% assign MAX_SIZE = 5 %}
{% assign all_list = "" | split: "" %}
{% for post in site.posts %}
{% if post.last_modified_at %}
{% capture elem %}
{{- post.last_modified_at | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
{% endcapture %}
{% assign all_list = all_list | push: elem %}
{% endif %}
{% endfor %}
{% assign all_list = all_list | sort | reverse %}
{% assign update_list = "" | split: "" %}
{% for entry in all_list limit:MAX_SIZE %}
{% assign update_list = update_list | push: entry %}
{% endfor %}