Ste*_*dge 124 rss mime-types
是否有一种MIME类型可以确保与RSS阅读器和其他搜索器的兼容性?
选项似乎是:
有趣的是Stackoverflow正在使用text/html.
var*_*tec 221
都不是.它是http://www.rssboard.org/rss-mime-type-application.txtapplication/rss+xml
Rob*_*ean 32
其他评论者指出,单一正确的哑剧类型是application/rss+xml,.
但是,如果您正在为客户端设置接受标头
Accept: application/rss+xml, application/rdf+xml;q=0.8, application/atom+xml;q=0.6, application/xml;q=0.4, text/xml;q=0.4
可能是一个不错的选择,因为它声明它接受RSS,Atom和XML(按降序或首选项).
Kai*_*ver 14
这是一个实用的答案:无论"正确"的答案是什么(并且显然存在争议),text/xml几乎所有流行的饲料都在野外使用.
以下是我检查的一些内容:
$ for f in \
https://feeds.feedburner.com/TechCrunch/ \
http://feeds.bbci.co.uk/news/video_and_audio/news_front_page/rss.xml \
http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml \
https://daringfireball.net/thetalkshow/rss \
http://www.npr.org/rss/podcast.php?id=381444908 \
http://feeds.serialpodcast.org/serialpodcast \
http://podcasts.joerogan.net/feed \
https://feeds.feedburner.com/thetimferrissshow \
http://feed.thisamericanlife.org/talpodcast ; do \
curl -s -I $f | fgrep -i Content-Type: ; done
content-type:text/xml; charset=UTF-8
Content-Type: text/xml
Content-Type: text/xml
Content-Type: text/xml;charset=UTF-8
Content-Type: text/xml;charset=UTF-8
Content-Type: text/xml; charset=UTF-8
Content-Type: text/xml; charset=UTF-8
content-type:text/xml; charset=UTF-8
Content-Type: text/xml; charset=UTF-8
Run Code Online (Sandbox Code Playgroud)
因此,您可以确定text/xml常用的RSS客户端将正确解释它.
最正确的是application/rss+xml
最兼容的是application/xml
根据 W3C:
RSS 提要应作为 application/rss+xml 提供(RSS 1.0 是一种 RDF 格式,因此它可以作为 application/rdf+xml 提供)。Atom 提要应该使用 application/atom+xml。或者,为了与广泛部署的 Web 浏览器兼容,这些提要中的任何一个都可以使用一种更通用的 XML 类型 - 最好是 application/xml。
https://validator.w3.org/feed/docs/warning/UnexpectedContentType.html
| 归档时间: |
|
| 查看次数: |
47462 次 |
| 最近记录: |