描述和内容之间的区别:RSS2 中的编码标签
RSS 2.0 格式规范中的
标记和
标记之间有何区别(如果有)?
其中一个比另一个更重要吗?
我应该在我的 Feed 中同时使用这两种方法还是一种就足够了?
What is the difference, if any, between the <description>
tag and the <content:encoded>
tag in RSS 2.0 format specifications?
Is one more important than the other?
Should I be using both in my feeds or one will suffice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
标签用于帖子摘要,但仅限于纯文本。没有标记。如果您转义标签或将内容包装在:
但是 你真的不应该这样做。
如果您想要标记,则应该使用
并使用和
]]> 包装器在这里。
简而言之,
代表 摘要和帖子的其余部分位于
中。由于某些读者可能不支持预期的标签,因此您通常会在
中看到整个帖子,而不是两者的混合。The
<description>
tag is for the summary of the post, but in plain text only. No markup.You can get around that if you escape the tags or wrap the content in:
But you're not really supposed to be doing that.
If you want markup, you're supposed to use
<content:encoded>
and use the<![CDATA[
and]]>
wrappers here.In short,
<description>
is for the summary and the rest of the post is in<content:encoded>
.Since some readers may not support the tags as expected, you usually see the entire post in
<description>
and not a mix of the two.之前的答案是不正确的。
RSS 2.0 规范非常清楚,您可以对的值进行编码。元素。
The previous answer is incorrect.
The RSS 2.0 spec is very clear that you can encode the value of the <description> element.
@random 给出的答案有一定道理,但最终情况很复杂(如果不令人困惑的话),如 RSS 2.0 规范,在决定如何处理
description
而不是 / 或在其他时候与content:encoded
一起处理时>。TLDR:当内容制作者愿意同时包含文本摘要和更完整的内容时,情况就解决了:使用
description
获得更简单的文本摘要,并使用content:encoded< /code> 以获得更完整的 html 内容。但是,当他们只想包含两者之一(仅包含摘要或仅包含更完整的内容)时,则应该使用
description
标签,在这种情况下,事情仍然不明确!在我看来,这是一个最不幸的决定,这意味着您必须包含更完整的 html 内容才能清楚地了解这一点,否则,description
标签将一如既往地含糊不清。人们必须慢慢思考这一切的含义,但我认为这些是要点:
描述< /代码> 标签。
description
标签放置在其旁边(实际上是在其上方),则content:encoded
永远不应该存在。description
)时,情况仍然像以前一样模棱两可:即description
仍然是一个简单的文本摘要,或者更完整的html内容,你不可能知道!description
应该是一个更简单的摘要,而content:encoded
将包含更完整的 html 内容。或者也许我读错了。
我个人认为这个决定是非常不幸的。显然,他们这样做是为了保持向后兼容性,因此当时的读者总是能够读取一些描述(因为尚不支持
content:encoded
,或者不广泛)。但这样做,他们基本上阻碍了这一点。现在一切都已经过去了,但我认为他们本可以做的,在两全其美的同时,向description
添加一个属性,例如:
.因此,如果
(请注意,他们指定content:encoded
对于更完整的 html 内容始终),那么它指定description
只是一个更简单的摘要,生产者不必也提供完整的内容以便读者了解此标签的类型。而老读者可能会忽略这个额外的属性。桥下流水,但我们可以梦想。因此,就目前情况而言,在我看来一切都完全悬而未决,**除非*包含两个标签,只有这样你才能做出正确的假设。
PS 至于完整内容和摘要内容的区别,请参见他们的原来的讨论< /a> 在
description
标签上。The answer given by @random has some truth to it, but ultimately the situation is complex (if not confusing), as specified within the RSS 2.0 spec, when deciding how to handle
description
instead of / or at other times alongside ofcontent:encoded
.TLDR: When a content producer is willing to include BOTH a textual summary AS WELL as fuller content, then the situation is cleared up: Use
description
for the simpler textual summary, andcontent:encoded
for the fuller html content. But when they only want to include one of the two, only summary or only fuller content, then they are SUPPOSED to use thedescription
tag for this, in which case things remain ambiguous! A most unfortunate decision in my estimate, it means you HAVE to include fuller-html content to have clarity on this, otherwise, thedescription
tag is just as ambiguous as ever.One has to slow-cook meditate on what this all meant, but I think these are the take-away points:
description
tag.content:encoded
SHOULD NEVER exist without adescription
tag placed alongside (and actually above) it.description
), that the situation remains as ambiguous as ever: I.e.description
continues to be EITHER a simple textual summary, OR a fuller html content, you can't know!description
should be a simpler summary, andcontent:encoded
will container fuller html content.Or maybe I read this all wrong.
Personally I think this decision was very unfortunate. They obviously did this to keep backwards compatibility, so readers at the time would be able to always have some description to read from (since
content:encoded
was not yet supported, or not widely). But in so doing, they basically handicapped this. It's water under the bridge by now, but I think what they could have done, while getting the best of both worlds, was to add an attribute todescription
like:<description type="html | text">
. So if<description type="text">
(note they specifycontent:encoded
is always for fuller html content) then it's specifyingdescription
is just a simpler summary, and the producer does NOT have to also give full-content in-order for readers to know the type of this tag. While older readers would have just ignored this extra attribute. Water under the bridge, but we can dream.So as it stands, it seems to me everything is completely up in the air, **unless* BOTH tags are included, only then can you make the right assumptions.
P.S. As for the distinction between full content and summary content, see their original discussion on the
description
tag.我测试了流行的播客客户端(2024 年),这些是我的结果。这并没有解决协议规定应该做什么,而只是解决了实践中实际要做的事情。
请注意,我没有尝试所有的组合。如果其他人尝试过其他组合,请随时将它们添加到我的表中(或作为评论)。特别是,我的播客软件不允许我不使用
,因此我没有单独测试
会发生什么。
显示了吗?AntennaPod (Android)
AntennaPod (Android)
podcastaddict.com、
tunein.com、
music.amazon.ca
podcastaddict.com、
tunein.com、
music.amazon.ca
<内容:编码> &
主要要点是:
,用户将会看到它(至少这是我在有限测试中看到的)因此,我的建议是:
标签就我个人而言,我会选择单独
因为我想在我的内容中添加 HTML 格式。I tested popular podcast clients (in 2024) and these are my results. This does not address what the protocols state should be done, but only what is actually done in practice.
Note that I didn't try all combinations of things. If someone else has tried other combinations, feel free to add them to my table (or as a comment). In particular, my podcasting software doesn't allow me to not use
<content:encoded>
, so I didn't test what happens with<description>
alone.<content:encoded>
shown?<description>
shown?<content:encoded>
<content:encoded> & <description>
AntennaPod (Android)
<content:encoded>
AntennaPod (Android)
<content:encoded> & <description>
podcastaddict.com,
tunein.com,
music.amazon.ca
<content:encoded>
podcastaddict.com,
tunein.com,
music.amazon.ca
<content:encoded> & <description>
The main takeaways are:
<content:encoded>
alone, users will see it (at least that's what I saw in limited testing)Thus, my suggestion is either:
<content:encoded>
tagPersonally, I'm going with
<content:encoded>
alone because I want to put HTML formatting in my content.