summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Ilvokhin <d@ilvokhin.com>2023-12-20 12:47:27 +0000
committerDmitry Ilvokhin <d@ilvokhin.com>2023-12-20 12:47:27 +0000
commita2fc2672206eb00c9df6afae26f7ba2e048c3830 (patch)
tree0d79b6c88573c56f5e1b893a4d0942f5aa7e6e78
parentd54216b239f7b02fcd74b64c90d891998e62d671 (diff)
downloadblog-a2fc2672206eb00c9df6afae26f7ba2e048c3830.tar.gz
blog-a2fc2672206eb00c9df6afae26f7ba2e048c3830.tar.bz2
blog-a2fc2672206eb00c9df6afae26f7ba2e048c3830.zip
Add author metadata tag to feed and posts
-rw-r--r--blog/post.py11
-rw-r--r--posts/hello-world/metadata.txt1
-rw-r--r--posts/libstdc++-std-unordered-map/metadata.txt1
-rw-r--r--templates/feed.html1
-rw-r--r--templates/post.html1
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" />