diff --git a/lumbunglib/feed.py b/lumbunglib/feed.py index 8c2bba0..1e25fdc 100644 --- a/lumbunglib/feed.py +++ b/lumbunglib/feed.py @@ -85,6 +85,10 @@ def create_frontmatter(entry): for t in entry.tags: tags.append(t['term']) + card_type = "network" + if entry.feed_name == "pen.lumbung.space": + card_type = "pen" + if "opds" in entry: frontmatter = { 'title':entry.title, @@ -105,7 +109,8 @@ def create_frontmatter(entry): 'author': author, 'original_link': entry.link, 'feed_name': entry['feed_name'], - 'tags': str(tags) + 'tags': str(tags), + 'card_type': card_type } return frontmatter @@ -196,9 +201,10 @@ def parse_posts(post_dir, post_content): allowed_iframe_sources = ["youtube.com", "vimeo.com", "tv.lumbung.space"] for img in soup(["img", "object"]): - local_image = grab_media(post_dir, img["src"]) - if img["src"] != local_image: - img["src"] = local_image + if img.get("src") != None: + local_image = grab_media(post_dir, img["src"]) + if img["src"] != local_image: + img["src"] = local_image for iframe in soup(["iframe"]): if not any(source in iframe["src"] for source in allowed_iframe_sources): diff --git a/lumbunglib/templates/feed.md b/lumbunglib/templates/feed.md index 74ddc3a..ddef11d 100644 --- a/lumbunglib/templates/feed.md +++ b/lumbunglib/templates/feed.md @@ -6,7 +6,7 @@ summary: "{{ frontmatter.summary }}" author: "{{ frontmatter.author }}" original_link: "{{ frontmatter.original_link }}" feed_name: "{{ frontmatter.feed_name}}" -categories: ["network", "{{ frontmatter.feed_name}}"] +categories: ["{{ frontmatter.card_type }}", "{{ frontmatter.feed_name}}"] tags: {{ frontmatter.tags }} ---