Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link, guid, and origLink in RSS feeds

Tags:

xml

rss

feed

By RSS specifications, <link> should specify the URL of the item. However, a lot of feeds are using <guid> or <servicename:origLink>. Some of them don't even have <link>. I'm making a RSS reader. If multiples of these tags are in a feed, which one should take precedence? Is there a standard for these tags?

like image 379
Leo Jiang Avatar asked Jan 26 '14 22:01

Leo Jiang


1 Answers

All of these fields have different purposes and you should use them for their purposes :)

The <guid> element may be a link or a URI, but it should be used to distinguish/identify unique entries. There should be a strict mapping between a given entry and its guid. You can think of it as a primary key. You should NOT expect that to be a valid link to a valid HTTP resource.

The <link> element corresponds to the main link to to the resource. That's probably the element you should use if you build a reader and want to redirect the user to the site that holds the news. This link may include tracking code or redirects that are used to count clicks and more.

The origLink element belongs to a specific namespace. For example, Feedburner uses it to link to the original resource. It should probably be used by your app if you want to extract data from the resource, without being accounted in the feedburner stats, for example. Few feeds actually have this field, so I would not use it without making sure that you can't handle it missing.

Generally, as RSS is XML (or almost always), it's extendable, which means any publisher can extend the RSS with custom fields. You should probably handle these extra fields with care.

like image 176
Julien Genestoux Avatar answered Oct 01 '22 15:10

Julien Genestoux