xhtmlboi / yocaml

YOCaml is a static site generator, mostly written in OCaml

Home Page:https://yocaml.github.io/doc/yocaml/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Atom syndication support

Tim-ats-d opened this issue Β· comments

Hello, it would be cool if YOcaml supported the Atom syndication format similarly to Yocaml.Rss module (Atom seems to be more used on the Geminispace πŸ˜›). I can make a patch to add this feature myself, but I saw that you use your own way to generate XML. I was thinking of using xmln, but that would be inconsistent with the Yocaml.Rss implementation. Is adding the dependency acceptable, and should I write the Atom support with it and leave the task of rewriting Yocaml.Rss to you?

Thanks!

I have no particular objection to adding an additional dependency although I think the ideal approach would be to make a yocaml_syndication plugin that depends on xmlm and supports RSS and Atom, what do you think? That would leave the yocaml package as dependency free as possible, while still adding decent support for RSS and Atom?

I can take care of it from next week but if you have the time and inclination, I'd love to have external contributions!

(Sorry for the delay)

It's a good idea I think but it would break the compatibility with the existing Yocaml.Rss module, isn't it? Also, I saw that we could use syndic to generate RSS and Atom feed instead of building "raw" XML with xmln

It's a good idea I think but it would break the compatibility with the existing Yocaml.Rss module, isn't it?

Not if you keep the module inside Yocaml (and we can use [@@alert] to deprecate the module but let's face it, it's possible that almost nobody uses YOCaml so it's really annoying :)

And I intend, one day, to make a v2 that will probably not be backwards compatible... (but in a delicate way, by introducing a Yocaml2 module for example).

Regarding Syndic, maybe @dinosaure has more insight?

yes I see, I will try a first draft for yocaml_syndic following these guidelines. Correct me if needed.

Edit:

I have no particular objection to adding an additional dependency although I think the ideal approach would be to make a yocaml_syndication plugin that depends on xmlm and supports RSS and Atom, what do you think? That would leave the yocaml package as dependency free as possible, while still adding decent support for RSS and Atom?

As far as I understand by reading the sources, making a separate plugin yocaml_syndication is impossible because Yocaml.Metadata depends of Yocaml.RSS (for the conversion of article metadata into RSS items) (https://github.com/xhtmlboi/yocaml/blob/main/lib/yocaml/metadata.ml#L136).

You can keep the module Rss, and add your own hook on metadata in your plugin yocaml_syndication.
(but the goal, for any YOCaml user is, in my opinion, to define their own metadata as capsule does)

If you need some improvements on Syndic, you can tell me but the library exists for a while now πŸ‘.

If you need some improvements on Syndic, you can tell me but the library exists for a while now +1.

Thanks for this library, I was just surprised by the lack of function Syndic.Rss2.to_xml similarly Syndic.Atom.to_xml πŸ™‚