{"action":"created","issue":{"url":"https://api.github.com/repos/jekyll/jekyll-feed/issues/90","repository_url":"https://api.github.com/repos/jekyll/jekyll-feed","labels_url":"https://api.github.com/repos/jekyll/jekyll-feed/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/jekyll/jekyll-feed/issues/90/comments","events_url":"https://api.github.com/repos/jekyll/jekyll-feed/issues/90/events","html_url":"https://github.com/jekyll/jekyll-feed/issues/90","id":128443510,"number":90,"title":"Only change the updated field if posts change","user":{"login":"mipstian","id":421341,"avatar_url":"https://avatars.githubusercontent.com/u/421341?v=3","gravatar_id":"","url":"https://api.github.com/users/mipstian","html_url":"https://github.com/mipstian","followers_url":"https://api.github.com/users/mipstian/followers","following_url":"https://api.github.com/users/mipstian/following{/other_user}","gists_url":"https://api.github.com/users/mipstian/gists{/gist_id}","starred_url":"https://api.github.com/users/mipstian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mipstian/subscriptions","organizations_url":"https://api.github.com/users/mipstian/orgs","repos_url":"https://api.github.com/users/mipstian/repos","events_url":"https://api.github.com/users/mipstian/events{/privacy}","received_events_url":"https://api.github.com/users/mipstian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-25T01:56:08Z","updated_at":"2016-03-23T11:54:08Z","closed_at":null,"body":"It'd be nice if this plugin would only update the value of the `atom:updated` element if there's change in the feed's contents.\r\n\r\n[RFC 4287](https://tools.ietf.org/html/rfc4287#section-4.2.15) says:\r\n> The \"atom:updated\" element is a Date construct indicating the most\r\n   recent instant in time when an entry or feed was modified in a way\r\n   the publisher considers significant.  Therefore, not all\r\n   modifications necessarily result in a changed atom:updated value.\r\n\r\nSo I think it's okay not to change that value every time the site is built.\r\n\r\nI think it should only change if there's a new post, of if any posts change, or if the feed header data changes. In other words, if building the feed would result in the same exact feed except for the `updated` element's value, then the feed doesn't need updating at all.\r\n\r\nThis also has the advantage of not needing to commit the new feed to version control, and not invalidating any caches of the feed for a meaningless change."},"comment":{"url":"https://api.github.com/repos/jekyll/jekyll-feed/issues/comments/200318466","html_url":"https://github.com/jekyll/jekyll-feed/issues/90#issuecomment-200318466","issue_url":"https://api.github.com/repos/jekyll/jekyll-feed/issues/90","id":200318466,"user":{"login":"mipstian","id":421341,"avatar_url":"https://avatars.githubusercontent.com/u/421341?v=3","gravatar_id":"","url":"https://api.github.com/users/mipstian","html_url":"https://github.com/mipstian","followers_url":"https://api.github.com/users/mipstian/followers","following_url":"https://api.github.com/users/mipstian/following{/other_user}","gists_url":"https://api.github.com/users/mipstian/gists{/gist_id}","starred_url":"https://api.github.com/users/mipstian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mipstian/subscriptions","organizations_url":"https://api.github.com/users/mipstian/orgs","repos_url":"https://api.github.com/users/mipstian/repos","events_url":"https://api.github.com/users/mipstian/events{/privacy}","received_events_url":"https://api.github.com/users/mipstian/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T11:54:08Z","updated_at":"2016-03-23T11:54:08Z","body":"I was thinking one of these:\r\n\r\n1. Using the most recent modified time of the *files* in `_posts` (i.e. from the filesystem) for `updated`\r\n2. Generating the new feed always, then checking if the only difference with the existing one is that field, and only writing if it isn't\r\n3. Saving the last `updated` used to write a feed somewhere, and then on subsequent generations, generating the feed using that `updated`, comparing it with the existing file, and only proceeding to write the new feed with an `updated` of \"now\" if they are different.\r\n\r\nThe first one seems way easier to implement, and will always write the feed, but I'm not sure if Jekyll exposes that info. If there's a way to grab that info, it might be the best choice. It might not be guaranteed to be accurate, but it will be in most cases, and if the feed is regenerated needlessly in rare occasions, it's fine. This might break if a post gets changed without changing its modified time somehow.\r\n\r\nThe second one is kind of simple but requires some kind of diffing which might be tricky. On the plus side, it's guaranteed to be correct.\r\n\r\nThe third one is also guaranteed to work, has no diffing, but requires some persistence for the updated value.\r\n\r\n2 and 3 also require access to the previously generated feed file's contents.\r\n\r\nCan't think of anything else at the moment!"}}