From 63a263724ce830251d45f60c0caf12aa20640e15 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 30 Dec 2023 22:16:33 -0600 Subject: [PATCH] simplify the expected feed structure I don't think there's any need for a million directories, on second thought, so just put YYMMDD prefixed files in the feed/ directory Signed-off-by: Brian S. Stephan --- incorporealcms/feed.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/incorporealcms/feed.py b/incorporealcms/feed.py index 6a3ebfb..305434f 100644 --- a/incorporealcms/feed.py +++ b/incorporealcms/feed.py @@ -1,8 +1,8 @@ """Generate Atom and RSS feeds based on content in a blog-ish location. -This parses a special root directory, feed/, for feed/YYYY/MM/DD/file files, +This parses a special root directory, feed/, for YYYYMMDD-foo.md files, and combines them into an Atom or RSS feed. These files *should* be symlinks -to the real pages, which may mirror the same YYYY/MM/DD/file naming scheme +to the real pages, which may mirror the same YYYYMMDD-foo.md file naming scheme under pages/ (which may make sense for a blog) if they want, but could just as well be pages/foo content. @@ -68,6 +68,6 @@ def serve_feed(feed_type): def _generate_feed_id(feed_entry_path): """For a relative file path, generate the Atom/RSS feed ID for it.""" - date = re.sub(r'.*/(\d+)/(\d+)/(\d+).*', r'\1-\2-\3', feed_entry_path) + date = re.sub(r'.*(\d{4})(\d{2})(\d{2}).*', r'\1-\2-\3', feed_entry_path) cleaned = feed_entry_path.replace('#', '/').replace('feed/', '', 1).replace(app.instance_path, '') return f'tag:{app.config["DOMAIN_NAME"]},{date}:{cleaned}'