Repository navigation
fix(metadata): parse a string updated_at from frontmatter - #225
Merged
eelcoj merged 1 commit intoNov 23, 2026
Merged
Conversation
A quoted updated_at (updated_at: "2023-05-15") reached the sitemap and feeds as a String, so String#iso8601 was undefined and sorting/max against Date or Time raised. Parse it with Time.zone.parse like published_at, and drop it when unparseable.
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.
A quoted
updated_atin frontmatter breaks the sitemap and feeds.Cause:
updated_atis passed through from frontmatter untouched. When it is quoted (updated_at: "2023-05-15") YAML gives aString, so the sitemap (resource.metadata.updated_at&.iso8601,modification_dates.max) and the feeds (sort_by { published_at || metadata.updated_at || Time.current }) fail:String#iso8601is undefined and comparing a String with Date/Time raisesArgumentError.Fix:
Metadatanow parses a Stringupdated_atwithTime.zone.parse(the same approachpublication_dateuses forpublished_at), and drops it when it cannot be parsed. Unquoted dates are unchanged.Test: two cases in
metadata_test.rb(quoted date becomes a Time; garbage value becomes nil). Both fail before the change; the full suite passes (447 runs).This PR was prepared with the assistance of an AI coding agent (Claude) and submitted by the account owner.