forked from cotes2020/jekyll-theme-chirpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-list.html
39 lines (32 loc) · 1.2 KB
/
update-list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!-- Get the last 5 posts from lastmod list. -->
{% assign MAX_SIZE = 5 %}
{% assign all_list = '' | split: '' %}
{% for post in site.posts %}
{% if post.last_modified_at and post.last_modified_at != post.date %}
{% 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 %}
{% if update_list.size > 0 %}
<section id="access-lastmod">
<h2 class="panel-heading">{{- site.data.locales[include.lang].panel.lastmod -}}</h2>
<ul class="content list-unstyled ps-0 pb-1 ms-1 mt-2">
{% for item in update_list %}
{% assign index = item | split: '::' | last | plus: 0 %}
{% assign post = site.posts[index] %}
{% assign url = post.url | relative_url %}
<li class="text-truncate lh-lg">
<a href="{{ url }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
</section>
<!-- #access-lastmod -->
{% endif %}