yogthos / clj-rss

a library for generating RSS feeds
63 stars 16 forks source link

Support for content:encoded #17

Open lccambiaghi opened 4 years ago

lccambiaghi commented 4 years ago

I'd like to add my blog feed to http://planet.clojure.in/ .

I learned what an RSS feed is and found this great library to create one.

I used this xml file as inspiration: https://www.clojuriststogether.org/index.xml .

How can I add to the entry the full HTML content? I I tried to add a :content:encoded tag to my entry map but the validation of rss/channel-xml fails.

Thank you!

yogthos commented 4 years ago

There isn't currently any explicit support for encoding HTML content. I'd be open to adding this as a feature. Looks like it's just a matter of wrapping content with <![CDATA[ ... ]]> according to the spec.

lccambiaghi commented 4 years ago

Thank you for your quick reply!

That would be awesome :)

yogthos commented 4 years ago

At the moment, it should work if you preprocess HTML content by wrapping it with CDATA before passing it to clj-rss.

lccambiaghi commented 4 years ago

But I would still to turn off validation right? The :content:encoded tag is not considered valid.

yogthos commented 4 years ago

The content:encoded tag is part of RSS 1.0, with RSS 2.0 you'd use description instead and pass it data wrapped with <![CDATA[ ... ]]>. It doesn't look like the spec specifies any other method for encoding.

lccambiaghi commented 4 years ago

Thank you, I will just use description then :)

lyderichti59 commented 3 years ago

I must admit that the RSS specification evolution is confusing. I would like to use clj-rss to generate my RSS files and provide both a summary description and the full content. As enlightened in this SO answer, this is what to infer from the RSS spec: For RSS >=2.0 :

I am in the second case. Could this be made possible with clj-rss (encoding considerations apart) ?

Thanks

yogthos commented 3 years ago

I'd be open to the change, but I don't have time to look at it in the near future. Would you be up for doing a PR to support this?

yogthos commented 3 years ago

And 0.2.7 is up on Clojars with the fix. 🎉