tags:

views:

27

answers:

2

RSS feed being generated on demand.
As far as I can see, for I have 2 options for lastBuildDate - current time or pubDate.
Which one would you choose and why?

A: 

The item having the newest PubDate should become the lastBuildTime.

[EDIT]: If there is a separate PubDate you are using too for whole feed, then lastBuildTime should be current time because you are building it at current time on-demand :).

[EDIT]: 2:: As lastBuildTime is optional and you're anyways including PubDate for whole feed, why not remove it from your feed output?

shamittomar
but there is also pubDate for the whole feed. there goes what you suggest, what's why I am in doubts for the lasBuildDate
Col. Shrapnel
@Col, edited the answer.
shamittomar
That's quite logical answer I am inclines to :)
Col. Shrapnel
A: 

According to the RSS 2.0 spec, lastBuildDate is the last time the content of the channel changed. (I'm not entirely satisfied with this definition because what if the feed's meta data changes? I think the common convention is to update lastBuildDate in that case, too.)

The channel-wide pubDate is supposed to be used for the original publication date of the items in the feed. It is never a good value to use for lastBuildDate because the pubDate is to stay unchanged even if the item gets updated.

Using the current time is the easy way out, but it's not perfect (because clients may start unnecessary operations due to the changed lastBuildDate)

The best way would be to actually know / find out when the feed's content last changed, and output that.

Related question

Pekka
Yeah, I came across this related question from google, should've mentioned it. Actually it was my previous question for this task :) Well, your vote for the same value as whole RSS's pubDate?
Col. Shrapnel
@Col no, my real vote would be the date of the last *real* change to the whole feed (items + any meta data). If that is not possible, then the current time.
Pekka
See, it's just a simple site news RSS. Assume it's items never being changed once posted. And there is no other information to change. Just plain and simple one-way feed. So, we can assume that max item's pub date is the actual feed change time. I should've mentioned it too. Assuming this, you are still for the site-wide PubDate value, right?
Col. Shrapnel
@Col if it's that simple, I would vote for using the maximum pubDate like @shamittomar says. No need for anything more complex in that case. If possible, I would avoid changing the `lastBuildTime` if no content has changed.
Pekka
Well just to omit this item at all seems sensible choice. Didn't think it that way, but it seems quite logical - if you don't know what to put into optional field - just don't use it!
Col. Shrapnel
@Col good point. Both fields *do* give the consumer some info about when to rebuild content on their end... But I doubt that matters for a simple news feed.
Pekka