9

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.

random
  • 9,774
  • 10
  • 66
  • 83
Uno Mein Ame
  • 1,060
  • 5
  • 16
  • 29

2 Answers2

11

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.

Community
  • 1
  • 1
tildy
  • 979
  • 10
  • 20
  • This would break the text mid word if the 250 character boundary was in the middle of a word. So you would end up with something like ...`char...`. – Treffynnon Jan 03 '12 at 10:23
  • So there is no standard? Anybody know what's a good policy? @Treffynnon - I don't care so much as to where it breaks since it seems that most modern readers will use `` anyway... – Uno Mein Ame Jan 03 '12 at 10:26
  • Treffynoon : yes , it cuts sometimes in the middle of the word. – tildy Jan 03 '12 at 10:30
  • `mb_substr` works in a safer way, avoiding truncate html codes, also you can use CSS `text-overflow: ellipsis` – Italo Hernández Feb 12 '20 at 00:47
0

RSS 2.00 Limits

RSS 1.00 only has a working version that was never officially published. Since it is completely different from 2.00, 0.92, and 0.91, it is largely just not implemented and skipped over.

No limits in RSS 2.00! To quote the documentation...

In RSS 0.91, various elements are restricted to 500 or 100 characters. There can be no more than 15 in a 0.91 . There are no string-length or XML-level limits in RSS 0.92 and greater. (Source: RSS 2.0 Specification.)

RSS 0.92 Limits

No limits! To quote the documentation...

In RSS 0.91 various elements are restricted to 500 or 100 characters. There can be no more than 15 in a 0.91 .

There are no string-length or XML-level limits in RSS 0.92. (Source: RSS 0.92 Specification)

RSS 0.91 Limits

Elements Limited to An Enum:

  • <language>channel Sub-element; may only be "en", "en-UK", "en-UK", etc.
  • <pubDate>channel Sub-element; may only be of the Date and Time Specification of RFC 822
  • <lastBuildDate>channel Sub-element; may only be of the Date and Time Specification of RFC 822
  • <width>image Sub-element; may only be an integer from 1 to 144.
  • <height>image Sub-element; may only be an integer from 1 to 400.
  • <name>textInput Sub-element; may only be an integer from 1 to 20.

Elements Limited to 100 Characters

  • <title>channel Sub-element; item Sub-element; image Sub-element; textInput Sub-element
  • <copyright>channel Sub-element
  • <managingEditor>channel Sub-element
  • <webMaster>channel Sub-element

Elements Limited to 500 Characters

  • <link>channel Sub-elements
  • <description>channel Sub-element; item Sub-element; textInput Sub-element
  • <rating>channel Sub-element
  • <docs>channel Sub-element
  • <url>image Sub-element
  • <link>item Sub-element; image Sub-element; textInput Sub-element

(Source: RSS 0.91 Specification.)

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133