From 82d8f2db984711f334f55b6af5098ec16770e824 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 8 Jan 2024 05:13:56 +0800 Subject: [PATCH] perf: include the latest posts in the "Recently Updated" list (#1456) Improve the "Recently Updated" list to include the most recent (only one Git commit) posts. This change has two benefits: 1. The post update list is consistent with the git commit timeline. 2. Avoid users not having a list of updates to show when they first publish a site. --- _includes/update-list.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/_includes/update-list.html b/_includes/update-list.html index cdeebeb..93684c3 100644 --- a/_includes/update-list.html +++ b/_includes/update-list.html @@ -1,16 +1,17 @@ - + {% 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 %}