📜 ⬆️ ⬇️

guid as a means of duplicates in RSS

Those who read Habr via RSS probably noticed that sometimes the same topic is duplicated in the tape. This happens when a post moves from one blog to another. The link changes, and RSS readers take it as a new topic. This behavior is easy to correct.

The uniqueness of an RSS post is determined by the guid tag. It can contain any string that uniquely identifies the message . Often, a permalink to a post is used as a similar line. In this case, the guid tag guid usually set the isPermalink="true" attribute, although it can be omitted, isPermalink="true" this is the default value. At the same time, guid is not necessary to use the link as a guid , because for this purpose, the RSS tag provides a link tag. In most RSS feeds, the contents of the guid and link tags guid duplicated:

  <guid isPermaLink = "true"> http://habrahabr.ru/blog/google/38273.html </ guid>
 <link> http://habrahabr.ru/blog/google/38273.html </ link> 

')
When the post is transferred to another blog, not only the link , but also the guid , which confuses readers. To avoid this situation, it is enough to use as a guid not a link, but a truly unique string, which does not change under any circumstances. Best for this purpose is suitable id post in the internal database. It is necessary to set the attribute isPermaLink="false" . In this case, the readers will use guid to determine the uniqueness of the post, and the link - as a link:

  <guid isPermaLink = "false"> 1234567890 </ guid>
 <link> http://habrahabr.ru/blog/google/38273.html </ link> 

Source: https://habr.com/ru/post/22255/


All Articles