Maximum length of RSS description item

烂漫一生 提交于 2020-01-02 01:41:08

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/8710676/maximum-length-of-rss-description-item

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!