From 581563e9e0200b214cf9b83010f5b01a4ac49100 Mon Sep 17 00:00:00 2001 From: CaffeineFueled Date: Mon, 20 Oct 2025 16:51:48 +0200 Subject: [PATCH 1/2] FIX posts path error in feeds #15 --- picopaper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/picopaper.py b/picopaper.py index 6b5f389..bd5f046 100644 --- a/picopaper.py +++ b/picopaper.py @@ -106,7 +106,7 @@ class SSGGGenerator: 'title': title, 'content': content, 'slug': parsed['name'], - 'url': f"{parsed['name']}/", + 'url': f"/{parsed['name']}/", 'feed': parsed['feed'], 'source': filepath.name } From af2f80032179d45a68d7239c1a850415eec80a91 Mon Sep 17 00:00:00 2001 From: CaffeineFueled Date: Mon, 20 Oct 2025 17:03:11 +0200 Subject: [PATCH 2/2] ADD /feed/ overview with counters #5 --- picopaper.py | 34 ++++++++++++++++++++++++++++++ theme/default/templates/feeds.tmpl | 20 ++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 theme/default/templates/feeds.tmpl diff --git a/picopaper.py b/picopaper.py index bd5f046..7576a38 100644 --- a/picopaper.py +++ b/picopaper.py @@ -143,6 +143,36 @@ class SSGGGenerator: print(f"✓ Generated {output_path}") + def generate_feeds_overview(self, feeds): + """Generate /feed/index.html with list of all non-excluded feeds""" + template = self.env.get_template('feeds.tmpl') + + # Prepare feed data with counts, excluding feeds in EXCLUDE_FEEDS_FROM_MAIN + feed_list = [] + for feed_name, posts in sorted(feeds.items()): + if feed_name not in self.exclude_feeds: + feed_list.append({ + 'name': feed_name, + 'count': len(posts) + }) + + title = f"Feeds - {self.blog_title}" + output_path = self.output_dir / 'feed' / 'index.html' + + html = template.render( + title=title, + blog_title=self.blog_title, + blog_description=self.blog_description, + navbar_items=self.navbar_items, + feeds=feed_list + ) + + output_path.parent.mkdir(parents=True, exist_ok=True) + with open(output_path, 'w', encoding='utf-8') as f: + f.write(html) + + print(f"✓ Generated {output_path}") + def generate_post_page(self, post): """Generate individual post page for 'long' posts""" template = self.env.get_template('post.tmpl') @@ -228,6 +258,10 @@ class SSGGGenerator: for feed_name, posts in feeds.items(): self.generate_index(posts, feed_name) + # Generate feeds overview page + if feeds: + self.generate_feeds_overview(feeds) + # Generate individual pages for long posts, short posts, and pages for post in all_posts: if post['type'] in ['long', 'short', 'page']: diff --git a/theme/default/templates/feeds.tmpl b/theme/default/templates/feeds.tmpl new file mode 100644 index 0000000..c03aae7 --- /dev/null +++ b/theme/default/templates/feeds.tmpl @@ -0,0 +1,20 @@ + + + + {% include 'meta.tmpl' %} + + + {% include 'header.tmpl' %} + +
+

Feeds

+
    + {% for feed in feeds %} +
  • {{ feed.name }} ({{ feed.count }} posts)
  • + {% endfor %} +
+
+ + {% include 'footer.tmpl' %} + +