diff options
| author | Dmitry Ilvokhin <d@ilvokhin.com> | 2023-12-20 12:47:27 +0000 | 
|---|---|---|
| committer | Dmitry Ilvokhin <d@ilvokhin.com> | 2023-12-20 12:47:27 +0000 | 
| commit | a2fc2672206eb00c9df6afae26f7ba2e048c3830 (patch) | |
| tree | 0d79b6c88573c56f5e1b893a4d0942f5aa7e6e78 /blog | |
| parent | d54216b239f7b02fcd74b64c90d891998e62d671 (diff) | |
| download | blog-a2fc2672206eb00c9df6afae26f7ba2e048c3830.tar.gz blog-a2fc2672206eb00c9df6afae26f7ba2e048c3830.tar.bz2 blog-a2fc2672206eb00c9df6afae26f7ba2e048c3830.zip | |
Add author metadata tag to feed and posts
Diffstat (limited to 'blog')
| -rw-r--r-- | blog/post.py | 11 | 
1 files changed, 8 insertions, 3 deletions
| 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) |