include post timestamp in ikiwiki GUIDs

The recent changes page can include multiple posts with the same GUID,
as the GUID is simply the URL of the page. In blog posts, that's
usually fine because we don't want to act every time a blog post
is *modified* but for things like link checks or archival, it's
actually important to fetch pages on each update.

This will require the user to run `--catchup` on the feeds with that
plugin enabled after upgrade.

We simply prefix the GUID with a ISO-8601 formatted timestamp so that
changes (above seconds increments) are considered
parent 08a79fc6
Pipeline #33469218 (#152) failed with stage
in 1 minute and 45 seconds
from datetime import datetime
from time import mktime
from urllib.parse import unquote
import logging
import re
......@@ -21,6 +23,10 @@ def filter(*args, item=None, **kwargs):
This generates a feed with proper ``<link>`` elements but requires
write access to the wiki.
This will also add the date to the URL GUID so that we refresh
when a page is updated. Otherwise feed2exec would think the entry
has already been passed.
"""
r = re.search(r'(https?://[^/]*/)ikiwiki.cgi\?do=goto&amp;page=([^"]*)"',
......@@ -30,3 +36,7 @@ def filter(*args, item=None, **kwargs):
logging.debug('link changed from %s to %s',
item['link'], link)
item['link'] = link
# append timestamp
t = mktime(item['published_parsed'])
item['id'] = datetime.fromtimestamp(t).isoformat() + '-' + item['id']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment