Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: include the latest posts in the "Recently Updated" list #1456

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions _includes/update-list.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<!-- Get the last 5 posts from lastmod list. -->
<!-- Get 5 last posted/updated posts -->

{% 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 %}
{% assign datetime = post.last_modified_at | default: post.date %}

{% capture elem %}
{{- datetime | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
{% endcapture %}

{% assign all_list = all_list | push: elem %}
{% endfor %}

{% assign all_list = all_list | sort | reverse %}
Expand Down