Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum length of RSS description item

Tags:

rss

Is there a length limit or maximum size for description tag inside an RSS item?

Also, does this tag accommodate HTML tags?

I will be generating both the <description> and <content:encoded> from the same source HTML and also wanted to know if the <description> tag accommodates HTML.

like image 490
Uno Mein Ame Avatar asked Jan 03 '12 10:01

Uno Mein Ame


People also ask

How many items should be on RSS feed?

If it's a news feed with dozens of new entries per day, 50 or 60 might be a good number, if it's only updated a few times per month or even less often, 20 will be more than enough.

What is RSS spec?

What is RSS? 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.

Is RSS and XML the same?

The important difference between these formats is that XML sitemaps describe the whole set of URLs within a site, while RSS/Atom feeds describe recent changes. This has important implications: XML sitemaps are usually large; RSS/Atom feeds are small, containing only the most recent updates to your site.

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.


1 Answers

As I know there are not a length limit. 2

In RSS 0.91, various elements are restricted to 500 or 100 characters. There can be no more than 15 < item >s in a 0.91 < channel >. There are no string-length or XML-level limits in RSS 0.92 and greater. Processors may impose their own limits, and generators may have preferences that say no more than a certain number of < item >s can appear in a channel, or that strings are limited in length.

Rss 2.0

For all elements defined in the RSS specification that enclose character data, the text should be interpreted as plain text with the exception of an item's description element, which must be suitable for presentation as HTML. All of these elements must not contain child elements.

There's no limit on the length of character data that can be contained in an RSS element.

So do you want to cut text somewhere and add ...? In this case just use substr.

$description = substr($description, 0, 250)."...";

Replace 250 by the size you want.

like image 131
tildy Avatar answered Nov 10 '22 18:11

tildy