2020-05-09 19:28:18 +03:00
|
|
|
{% comment %}
|
2020-06-03 17:49:28 +03:00
|
|
|
Get the last 5 posts from lastmod list.
|
2020-05-09 19:28:18 +03:00
|
|
|
v2.2
|
|
|
|
https://github.com/cotes2020/jekyll-theme-chirpy
|
|
|
|
© 2020 Cotes Chung
|
|
|
|
MIT License
|
|
|
|
{% endcomment %}
|
|
|
|
|
|
|
|
{% assign MAX_SIZE = 5 %}
|
2020-07-15 11:49:02 +03:00
|
|
|
|
|
|
|
{% assign all_list = "" | split: "" %}
|
2020-05-09 19:28:18 +03:00
|
|
|
|
2020-11-18 20:58:35 +03:00
|
|
|
{% for post in site.posts %}
|
|
|
|
{% if post.lastmod %}
|
|
|
|
{% capture elem %}
|
|
|
|
{{- post.lastmod | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
|
|
|
|
{% endcapture %}
|
|
|
|
{% assign all_list = all_list | push: elem %}
|
|
|
|
{% endif %}
|
2020-05-09 19:28:18 +03:00
|
|
|
{% endfor %}
|
|
|
|
|
2020-07-15 11:49:02 +03:00
|
|
|
{% 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 %}
|