-
-
Notifications
You must be signed in to change notification settings - Fork 7k
refactor: make Further Reading display the latest posts. #1699
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
refactor: make Further Reading display the latest posts. #1699
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to add the release date as a sorting factor, putting the match_posts
in reverse order will do it.
{% assign match_posts = match_posts | reverse %}
Signed-off-by: Huanyu Shi <100574401+huanyushi@users.noreply.github.com>
Thanks for your suggestions, I have already made the modification. If you don't think the theme needs to be changed, you can just close this PR. |
🎉 This PR is included in version 7.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Type of change
Description
I modified the code in
_includes/related-posts.html
to enable Further Reading to display the latest posts, as stated in the title.I need to explain why I made this change.
Consider a scenario where we have five different posts, e.g.
each of which has the same score calculated in
_includes/related-posts.html
. When we open any of these posts, Further Reading always displays the three oldest posts instead of the three most recently updated ones.Before
As an example, when we open
Title4
post, It showsTitle1
,Title2
andTitle3
,The same is true when opening
Title5
. No matter how many posts we write later, it will always display only the first 3 posts.After
We might prefer it to show the latest 3 posts, e.g.
Title2
,Title3
,Title5
. My PR can make the blog produce the following effects:Additional context
I'm not familiar with Liquid, so these changes were based on my interpretation of the official documentation. There may be other ways to further simplify it, but it does work effectively.