Welcome to WebmasterWorld Guest from 54.167.46.29

Forum Moderators: bill & werty

Message Too Old, No Replies

HTML tags in rss feeds?

Is this possible and "legal"

     
4:33 pm on Sep 25, 2008 (gmt 0)

Preferred Member

5+ Year Member

joined:Nov 15, 2007
posts:610
votes: 1


I'm automating a feed that contains updates on my web site, and the way it is set up it uses html code that is embedded in some of the items take from my website. (like simple tags -- paragraphs.

When it gets parsed it spits out errors or stops at the first illegal tag, suggesting to me such things aren't allowed. Is there a way to have tags embedded (since I can't remove them) and have things work?

Thanks.

1:02 am on Sept 26, 2008 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
posts:14487
votes: 49


Does the feed validate? [validator.w3.org]

Where are these HTML tags showing up?
Does a <description> element contain HTML markup?

If you need HTML tags in the feed itself you should use some HTML Character Entity Encoding. For example using the <BR> tag:

<description>Blah blah blah blah blah blah blah blah &lt;BR&;gt; blah blah blah blah blah blah.</description>

[edited by: bill at 12:21 am (utc) on Dec. 17, 2008]

11:20 am on Dec 13, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 12, 2003
posts:1199
votes: 0


I have the same question. From what I can gather, HTML tags aren't allowed inside the <description></description> tags. If I'm delivering a long article via RSS, I'd like to use <p> tags to break up the content, and I see that some news feeds do the same thing, and RSS readers seem to understand that. But the feed won't pass validation if I use <p> tags.

Similarly, I'd like to link to other content from my articles with <a href> tags, but that also kills validation. I think my options are:

(1) Don't use any tags, and have annoying long articles without breaks or links.
(2) Use <p> and <a> tags, and don't be concerned that the feed doesn't validate.

Is this correct?

12:58 am on Dec 16, 2008 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
posts:14487
votes: 49


Right, you encode the tags.

&lt;p&gt; = <p>
&lt;/p&gt; = </p>
2:38 pm on Dec 16, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 12, 2003
posts:1199
votes: 0


I'm sorry, I misunderstood. I thought you were saying to use encoding if I want the user to be able to see the tags, if, for example, I'm writing an article about HTML. I tried encoding the tags and they work great, thanks.

But this begs the question: What if I *do* want the user to see the tags. On an HTML page &lt; will show the user a < sign. How do I show the < and > signs in an RSS feed?

12:48 am on Dec 17, 2008 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
posts:14487
votes: 49


XML has the following entity references:
  • &amp;
    (& or "ampersand")
  • &lt;
    (< or "less than")
  • &gt;
    (> or "greater than")
  • &apos;
    (' or "apostrophe")
  • &quot;
    (" or "quotation mark")

    You would use those codes in lieu of the characters in your feed. The HTML tags that use these characters are parsed by the system displaying the feed.

  • 2:14 am on Dec 17, 2008 (gmt 0)

    Senior Member

    WebmasterWorld Senior Member 10+ Year Member

    joined:Feb 12, 2003
    posts:1199
    votes: 0


    Well, in my test the characters didn't show up. I included the string "<manchu>" in a description but it didn't. show up. Perhaps naked < and > characters will show up if they don't look like tags, but if everything that looks like a tag tries to get parsed as such, I think that means that I can't have an article about HTML tags, because there's no way to display things like <p> to the user. Is that right?
     

    Join The Conversation

    Moderators and Top Contributors

    Hot Threads This Week

    Featured Threads

    Free SEO Tools

    Hire Expert Members