refactor: make Further Reading display the latest posts. #1699
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.