Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSS specification HTML code inside RSS feed

Tags:

html

rss

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

like image 634
filype Avatar asked Mar 26 '12 04:03

filype


People also ask

Can RSS contain HTML?

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

How do I display an RSS feed in HTML?

How To Display RSS Feed In HTML Website? Step 1: Select HTML as your website platform from the options. Step 2: Set the width and height (or auto) of your feed and click on “Get Code”. Step 3: Copy the given Code and paste it into the back-end of any webpage where you want to display RSS feed.

Does RSS use XML?

RSS is a Web content syndication format. Its name is an acronym for Really Simple Syndication. RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification, as published on the World Wide Web Consortium (W3C) website.


2 Answers

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> 
like image 95
random Avatar answered Sep 30 '22 18:09

random


You can decode < and > char to html code

< : &lt;

> : &gt;

like image 20
Nguyễn Hoàng Gia Avatar answered Sep 30 '22 18:09

Nguyễn Hoàng Gia