leven icon indicating copy to clipboard operation
leven copied to clipboard

Atom syndication

Open andete opened this issue 6 years ago • 3 comments

Implementation for #25 . Allows to generate an atom feed for the blog. Validated with w3c and tested with feedly and found to work fine. Following fields are required for it in Leven.toml:

  • uuid (a uuid, used to identify the feed)
  • home_url (the homepage of the feed website)
  • base_url (the base url of the blog, could be same as home_url but doesn't have to)
  • feed_url (the url of the feed.xml, could perhaps be derived from base_url)
  • author (the author of the blog)
  • email (the email of the author)

Optionally a date can also be specified to be used for the generated feed xml, if not specified, now is used.

andete avatar Feb 27 '18 12:02 andete

This looks amazing! I'll read over it as soon as I get home. :)

quadrupleslap avatar Feb 27 '18 21:02 quadrupleslap

I have a few (very minor) questions:

  • Post.date is already the last updated (i.e. modified) date, so what's the point of adding an updated_date field, too?
  • Instead of changing the default date format in build_atom_feed, wouldn't it be easier to use date.iso8601 in the template? That's basically what it's there for, anyway.
  • config.date should probably be replaced with another global named now.
  • feed.html should be feed.xml, and it isn't currently being written out in init/mod.rs like it should be. Edit: This is my fault, because the template engine assumes the extension is .html, doesn't it? Maybe I should fix that after accepting this pull request.
  • I'm still not sure which syntax is better for frontmatter, but I'm leaning towards ^---$ (i.e. --- that is on its own line). Is it okay if I use that instead?
  • Edit: Also, I think it might be a good idea to add <link rel="alternate" type="application/atom+xml" title="Blog" href="/feed.xml to the default index.html template.

I can write the rest of the code now, that's the easy part. Again, thanks for the massive contribution! :)

quadrupleslap avatar Mar 04 '18 08:03 quadrupleslap

Hey,

the reason for updated is that posts can have a date, which is the date it was first posted, and an updated date, which is the date it was potentially updated at a later point. The updated matters for feed readers, and the normal date is the date it shows as being posted, even when updated, cause otherwise the time order of the posts would change. I hope that makes sense.

Yes, I used feed.html because of the template engine. It doesn't really matter though, no, it's just a name? I don't mind about the frontmatter syntax, happy to implement the change for my blogs, I've only got a few posts for now anyway.

Joost

On Sun, Mar 4, 2018 at 9:24 AM Ram [email protected] wrote:

I have a few (very minor) questions:

  • Post.date is already the last updated (i.e. modified) date, so what's the point of adding an updated_date field, too?
  • Instead of changing the default date format in build_atom_feed, wouldn't it be easier to use date.iso8601 in the template? That's basically what it's there for, anyway.
  • config.date should probably be replaced with another global named now .
  • feed.html should be feed.xml, and it isn't currently being written out in init/mod.rs like it should be. Edit: This is my fault, because the template engine assumes the extension is .html, doesn't it?
  • I'm still not sure which syntax is better for frontmatter, but I'm leaning towards ^---$ (i.e. --- that is on its own line). Is it okay if I use that instead?

I can write the rest of the code now, that's the easy part. Again, thanks for the massive contribution! :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/quadrupleslap/leven/pull/26#issuecomment-370210946, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqDeSEhfGCjA0tFBSyROuAKA15ugQ3cks5ta6SmgaJpZM4SU0Us .

andete avatar Mar 04 '18 08:03 andete