From a2fc2672206eb00c9df6afae26f7ba2e048c3830 Mon Sep 17 00:00:00 2001 From: Dmitry Ilvokhin Date: Wed, 20 Dec 2023 12:47:27 +0000 Subject: Add author metadata tag to feed and posts --- blog/post.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'blog') diff --git a/blog/post.py b/blog/post.py index 1ac8dfa..8a7c880 100644 --- a/blog/post.py +++ b/blog/post.py @@ -10,13 +10,16 @@ import render class Metadata(object): - __slots__ = ("title", "date", "status") + __slots__ = ("title", "author", "date", "status") title: str + author: str date: str status: str - def __init__(self, title: str, date: str, status: str) -> None: + def __init__(self, title: str, author: str, + date: str, status: str) -> None: self.title = title + self.author = author self.date = date self.status = status @@ -48,10 +51,11 @@ class Post(object): "metadata.txt")) title = raw["Title"] + author = raw["Author"] date = raw.get("Date", datetime.date.today().strftime("%Y-%m-%d")) status = raw.get("Status", "draft") - return Metadata(title, date, status) + return Metadata(title, author, date, status) def generate(self, basedir: str) -> None: postdir = os.path.basename(self.directory) @@ -72,6 +76,7 @@ class Post(object): content = render.to_html(md) rendered = self.template.render(title=self.metadata.title, + author=self.metadata.author, date=self.metadata.date, status=self.metadata.status, content=content) -- cgit v1.2.3-70-g09d2