45

Is HTML code inside the <description> tag compliant in RSS 2.0?

2 Answers 2

73

The RSS 2.0 specification says that you can include HTML in the description element so long as you properly encode the markup.

You have two ways to do this:

  1. Convert tags to escaped HTML entities:

    <description>this is &lt;b&gt;bold&lt;/b&gt;</description>
    
  2. Wrap the description content within a CDATA section:

    <description><![CDATA[this is <b>bold</b>]]></description>
    
3

You can decode < and > char to html code

< : &lt;

> : &gt;

3
  • 1
    You also need to change the ampersand (&) character. Feb 5, 2016 at 22:00
  • And to be safe, the " and ' characters too, in addition to &, < and >.
    – Flimm
    Dec 28, 2016 at 13:50
  • This is the complete list (5 predefined entities): en.wikipedia.org/wiki/… May 3, 2019 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.