Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I know the default is to send the Last-Modified HTTP header out as the time of request, and I can't really comment on that. But for RSS feeds, that date should be more representative of the content of the feed. The attached patch changes that date from the request time to the pubDate of the first, most recent, node in the feed. This will help services like Twitterfeed that rely on Last-Modified headers to check whether a feed has updated.
If this makes sense, I can do something similar for D8.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2177779-rss_modified-2.patch | 732 bytes | chellman |
rss_last_modified.patch | 676 bytes | chellman | |
Comments
Comment #2
chellman CreditAttribution: chellman commentedComment #3
chellman CreditAttribution: chellman commentedComment #4
drasgardian CreditAttribution: drasgardian commentedIt doesn't look like this will change the last-modified http header if a node is removed from the feed.
Perhaps this could be tied in with views caching. i.e. when serving a cached version of the feed set the last-modified header to the timestamp of when the cache was generated.
Comment #5
chellman CreditAttribution: chellman commentedThanks for taking a look. This particular patch doesn't have anything to do with Views, but I'm curious about the other issue.
You're saying the feed's modified date should change if some other, earlier node is removed? I guess technically the feed has changed in that case, but at that point there still aren't any new nodes in the feed (if one is removed, it's replaced by an older one). Considering that this core RSS feed is generally pretty much just for syndicating new content, I don't know if updating the feed's date in that case really matters. I'm saying the feed's date should be the same as that of the newest node.