diff --git a/build.py b/build.py index 81012db..9dea397 100755 --- a/build.py +++ b/build.py @@ -78,9 +78,31 @@ def main(): # Apply metadata to the template if meta_title := meta.get("title"): - title = "".join(meta_title) - page.title.string = title - page.header.h1.string = title + page.title.string = meta_title[0] + page.header.h1.string = meta_title[0] + + if meta_date := meta.get("date"): + p = page.new_tag("p") + p["class"] = "metadata" + p.string = "Date: " + meta_date[0] + page.header.append(p) + + if meta_author := meta.get("author"): + p = page.new_tag("p") + p["class"] = "metadata" + p.string = "Author: " + meta_author[0] + page.header.append(p) + + if meta_source := meta.get("source"): + for source_url in meta_source: + a = page.new_tag("a") + a["href"] = source_url + a.string = source_url + p = page.new_tag("p") + p["class"] = "metadata" + p.string = "URL: " + p.append(a) + page.header.append(p) # The fully templated page is the new content content = str(page) diff --git a/src/.template.html b/src/.template.html index 88d6f29..6416455 100644 --- a/src/.template.html +++ b/src/.template.html @@ -14,6 +14,10 @@ nav { font-size: 1.2em; font-family: monospace; } +header .metadata { + font-size: small; + margin-block: 0; +} h1 { line-height: 1em; }