问题
I'm working on an RSS feed for a custom tasking system we use, and I'm still wrapping my head around how things should work. What I want to have is a feed for each user that shows tasks assigned to them, and additionally a feed for each task that shows updates for the task.
What I want to know right now concerns the user feed. When a case assigned to a user is updated, I currently have code to change the pubDate entry for that item and the lastBuildDate for the channel. I was hoping this would make the item appear as unread in readers so that the user would know to look at the item again, but this seems not to be the case. Should I be changing the guid, even though it's really the same items? What would the side-effects of that be?
Is there anything I'm missing? How can I solve this?
回答1:
Changing the <pubDate> does indicate that the entry changed, but there is no requirement that a given RSS reader do anything about it. (Strictly speaking, there is no requirement than an RSS reader do anything, but let's remain reasonable.) Some reader do mark updated entries as changed. For example Bloglines.com can optionally detect changes in the <description> and mark entries as new again if that case.
Depending on your reader, changing the <title>, <description>, or <pubDate> might give you the behavior you want. But as GateKiller mentions above, your safest option is to make it an entirely new entry with a new <guid>. While you're at it, you might want to use it as an opportunity to add a direct link or details about the update.
Of course, if you're writing both the producer and consumer of the RSS, and your goal is that the feed always contains the full set of assigned tasks, just updating the <pubDate> will work just fine.
回答2:
The solution is to also change the GUID which means including the updated time in it. The GUID provides the uniqueness for each item in the feed and will be marked as unread if you put the date updated in it.
来源:https://stackoverflow.com/questions/164124/rss-item-updates