diff options
-rw-r--r-- | blog/post.py | 11 | ||||
-rw-r--r-- | posts/hello-world/metadata.txt | 1 | ||||
-rw-r--r-- | posts/libstdc++-std-unordered-map/metadata.txt | 1 | ||||
-rw-r--r-- | templates/feed.html | 1 | ||||
-rw-r--r-- | templates/post.html | 1 |
5 files changed, 12 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) diff --git a/posts/hello-world/metadata.txt b/posts/hello-world/metadata.txt index e3057c4..4c57cf0 100644 --- a/posts/hello-world/metadata.txt +++ b/posts/hello-world/metadata.txt @@ -1,3 +1,4 @@ Title: Hello, World! +Author: Dmitry Ilvokhin Date: 2022-12-23 Status: published diff --git a/posts/libstdc++-std-unordered-map/metadata.txt b/posts/libstdc++-std-unordered-map/metadata.txt index 1f08fa9..24b3750 100644 --- a/posts/libstdc++-std-unordered-map/metadata.txt +++ b/posts/libstdc++-std-unordered-map/metadata.txt @@ -1,3 +1,4 @@ Title: How libstdc++ `std::unordered_map` implemented? +Author: Dmitry Ilvokhin Date: 2023-07-02 Status: published diff --git a/templates/feed.html b/templates/feed.html index 7d5a325..deb89c5 100644 --- a/templates/feed.html +++ b/templates/feed.html @@ -6,6 +6,7 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="title" content="blog.ilvokhin.com"> + <meta name="author" content="Dmitry Ilvokhin"> <title>blog.ilvokhin.com</title> <link rel="stylesheet" type="text/css" href="/style.css"/> diff --git a/templates/post.html b/templates/post.html index 56bdef8..20c3ac2 100644 --- a/templates/post.html +++ b/templates/post.html @@ -6,6 +6,7 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="title" content="{{ title }}"> + <meta name="author" content="{{ author }}"> <title>{{ title }} | blog.ilvokhin.com</title> <link rel="stylesheet" type="text/css" href="/style.css" /> |