yogthos/clj-rss

Support for content:encoded

lccambiaghi opened this issue ยท 9 comments

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!

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.

Thank you for your quick reply!

That would be awesome :)

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

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

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.

Thank you, I will just use description then :)

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 :

  • if you want to provide a summary description xor the full content, use the <description> tag only.
  • if you want to provide both a summary description and the full content, use <description> followed by <content:enclosed>.

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

Thanks

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?

And 0.2.7 is up on Clojars with the fix. ๐ŸŽ‰