Repository navigation
Order feeds by the publication date, including one from the filename - #220
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
The RSS, Atom and JSON feeds sorted their items by `metadata.published_at`, the raw frontmatter value, while the items show `Resource#published_at`, which also takes the date from a `YYYY-MM-DD-slug` filename. A post dated only by its filename had no frontmatter date, so it was sorted as if published now: it went above newer posts dated in the frontmatter, and with `max_items` could push them out of the feed. The feeds now sort by `Resource#published_at`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The RSS, Atom and JSON feed builders sort their items with
metadata.published_atis the raw frontmatter value. The templates showresource.published_atinstead (pubDate,<published>,date_published), and that one also picks up the date from a2020-01-01-slug.mdfilename. So a post dated only by its filename has no frontmatter date and is sorted as if it was published now:2020-01-01-filename-dated.md(nopublished_at) is listed abovefrontmatter-dated.mdwithpublished_at: 2025-12-01, even though itspubDatesays 2020.max_items, those old posts take the top slots and can push newer posts out of the feed.The existing "sorted by date" tests pass only because the dummy posts are all filename-dated and loaded in filename order. Each
Time.currentis a little later than the last, so the reverse sort happens to come out right.Fix
Sort by
it.published_at, the same value the templates render, in all three builders. Theupdated_atandTime.currentfallbacks are unchanged.Tests
bin/rails teston Ruby 3.4: 432 runs, 1010 assertions, 0 failures.standardrbclean.🤖 Generated with Claude Code