40

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?

0

3 Answers 3

43

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:

<![CDATA[ post body goes <strong>here</strong> ]]>

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.

The content:encoded element can be used in conjunction with the description element to provide an item's full content along with a shorter summary. Under this approach, the complete text of the item is presented in content:encoded and the summary in description.

###RSS Best Practices Profile: content:encoded

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.

1
16

The previous answer is incorrect.

The RSS 2.0 spec is very clear that you can encode the value of the <description> element.

An item may also be complete in itself, if so, the description contains the text (entity-encoded HTML is allowed; see examples), and the link and title may be omitted. All elements of an item are optional, however at least one of title or description must be present.

1
  • 8
    This does not answer the OP's question. If description can also be encoded, what is the difference then? Nov 16, 2018 at 7:19
7

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 of content: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, and content: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 the description 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, the description tag is just as ambiguous as ever.

Publishers who don't want to employ item summaries in their feeds SHOULD use the description element for an item's full content rather than content:encoded because it has the widest support.

Publishers who employ summaries SHOULD store the summary in description and the full content in content:encoded, ordering description first within the item. On items with no summary, the full content SHOULD be stored in description.

One has to slow-cook meditate on what this all meant, but I think these are the take-away points:

  1. If only one of these two tags is given, it MUST be the description tag.
  2. That means content:encoded SHOULD NEVER exist without a description tag placed alongside (and actually above) it.
  3. Unfortunately this means that when there is only one tag (which must be 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!
  4. When BOTH are given, that's the only time the ambiguity is removed: Then description should be a simpler summary, and content: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 to description like: <description type="html | text">. So if <description type="text"> (note they specify content:encoded is always for fuller html content) then it's specifying description 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.