What is the difference between <pubDate> and <lastBuildDate> in RSS?

风格不统一 提交于 2019-12-06 16:32:48

问题


I have the feeling, in every RSS.xml file, both the pubDate and the lastBuildDate match.

I am sure that this one, is not always true...

So firstly, what is the difference between those two above?

Secondly, the RSS readers, sort the content by Date, based on the pubDate or the lastBuildDate?


回答1:


pubDate:

The original publication date for the channel or item. (optional)

lastBuildDate:

The most recent time the content of the channel was modified. (optional)


Here are some docs for the optional items in the RSS 2.0 spec.




回答2:


Answers here are all over the place. Some people are getting confused by the fact that item has a pubDate as well. I believe the OP is specifically asking about the difference between lastBuildDate and pubDate at the channel level.

From the best of my understanding of the RSS spec, which is notorious for ambiguous explanations, lastBuildDate would be the last time the feed was created. For example, if you cache a copy of it on your server for some period of time, lastBuildDate would the time that cached copy was created.

pubDate, on the other hand, seems to be basically the last time any actual content within the feed has changed. For the most part it's pretty much going to be the latest pubDate value from the items in the feed, since generally, the feed content is only changing when some new item gets published. However, it could also be a date when you made some change to the channel, itself, such as changing the channel title, description, etc.




回答3:


lastBuildDate specifies the last date/time the entry was modified. pubDate specifies the actual publication date/time.

The reason you see these as generally the same is because by the time you get the RSS feed, there hasn't been any edit to the article.

I can't find the RSS spec on this unfortunately, but I am pretty positive that's what they are.




回答4:


By RSS 2.0 specification, it seems they are roughly equivalent:

lastBuildDate:

The last time the content of the channel changed.

pubDate:

The publication date for the content in the channel. ...

The difference is subtle: They tell us about the method that was used. In case of <pubDate>, the channel is published manually or in fixed period. In case of <lastBuildDate>, the channel is built automatically upon new article being added on the website, adding it as new item.




回答5:


While the other answers here do provide some good information, I feel the need to elaborate just a little bit for any future visitors.

pubDate
The publication date for the content in the channel. For example, the New York Times publishes on a daily basis, the publication date flips once every 24 hours. That's when the pubDate of the channel changes.

lastBuildDate
The last time the content of the channel changed.

So, taking the New York Times as an example again, the <pubDate> is the date the feed was published while the <lastBuildDate> would be the date the content inside the feed changed. In the end, I would view the <pubDate> as the date the feed is published and the <lastBuildDate> as the date any content in the feed was last modified.



来源:https://stackoverflow.com/questions/1698076/what-is-the-difference-between-pubdate-and-lastbuilddate-in-rss

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!