feed: assign pen category

This commit is contained in:
knoflook 2022-04-21 14:17:12 +02:00
parent 7d3863641d
commit 3ea798b301
Signed by: knoflook
GPG Key ID: D6A1D0E8FC4FEF1C
2 changed files with 11 additions and 5 deletions

View File

@ -85,6 +85,10 @@ def create_frontmatter(entry):
for t in entry.tags: for t in entry.tags:
tags.append(t['term']) tags.append(t['term'])
card_type = "network"
if entry.feed_name == "pen.lumbung.space":
card_type = "pen"
if "opds" in entry: if "opds" in entry:
frontmatter = { frontmatter = {
'title':entry.title, 'title':entry.title,
@ -105,7 +109,8 @@ def create_frontmatter(entry):
'author': author, 'author': author,
'original_link': entry.link, 'original_link': entry.link,
'feed_name': entry['feed_name'], 'feed_name': entry['feed_name'],
'tags': str(tags) 'tags': str(tags),
'card_type': card_type
} }
return frontmatter return frontmatter
@ -196,6 +201,7 @@ def parse_posts(post_dir, post_content):
allowed_iframe_sources = ["youtube.com", "vimeo.com", "tv.lumbung.space"] allowed_iframe_sources = ["youtube.com", "vimeo.com", "tv.lumbung.space"]
for img in soup(["img", "object"]): for img in soup(["img", "object"]):
if img.get("src") != None:
local_image = grab_media(post_dir, img["src"]) local_image = grab_media(post_dir, img["src"])
if img["src"] != local_image: if img["src"] != local_image:
img["src"] = local_image img["src"] = local_image

View File

@ -6,7 +6,7 @@ summary: "{{ frontmatter.summary }}"
author: "{{ frontmatter.author }}" author: "{{ frontmatter.author }}"
original_link: "{{ frontmatter.original_link }}" original_link: "{{ frontmatter.original_link }}"
feed_name: "{{ frontmatter.feed_name}}" feed_name: "{{ frontmatter.feed_name}}"
categories: ["network", "{{ frontmatter.feed_name}}"] categories: ["{{ frontmatter.card_type }}", "{{ frontmatter.feed_name}}"]
tags: {{ frontmatter.tags }} tags: {{ frontmatter.tags }}
--- ---