-
Notifications
You must be signed in to change notification settings - Fork 5
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
Clean up Item
dates
#22
Comments
Working on this, and I have some thoughts.
I kept Since |
The readers got greatly simplified with the recent change, see for example loopwerk/SagaParsleyMarkdownReader@9605b14. Love it! |
Thinking about this some more... these two functions could just take a closure that returns a writable Date for a given Item. That way nothing needs to be hardcoded and the Item doesn't have to ship with a date property. No need to try to read the date from the metadata by itself, when nothing else is done automatically like that. Not 100% sure about it yet, if it's worth yet another breaking change. Need to play around with this. |
Right now an
Item
has three date properties:This seems rather silly. RSS/Atom feeds need the
lastModified
date, so it makes sense to keep this.But as for
published
date, and thecreated
date... they seem to mostly serve the same purpose. And the readers are trying to read adata
properly from the markdown frontmatter to fill thepublished
property, even though Saga has absolutely no default handling for any other metadata. And every reader now has to deal with this, try to read adate
from the frontmatter.I think the readers should only return a title, the HTML body, and the metadata as a
[String: String]
dict instead of an entireItem
instance, let Saga deal with all those properties and the metadata, let it create theItem
instance. A lot less repetition in the readers, and it makes it a lot easier to make changes in Saga without having to then also modify every reader.I think
published
should be removed, along with the default frontmatter handling. If you want to have adate
orpublished
field in yourItem
, simply add it to the strongly typed metadata, and the metadata parser will take it from there. No magic handling of a single data property.As for
created
, not sure if I should keep it. It doesn't hurt to keep it, but on the other hand since this date is so unreliable (see #21), maybe best to not expose it by default.Obviously this would be a breaking change.
The text was updated successfully, but these errors were encountered: