From: Max Value Date: Mon, 16 Dec 2024 13:53:24 +0000 (+0000) Subject: Added git history to pages & updated .gitignore X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=924e41be922effb50d5359056ff415a6caed14fe;p=blog Added git history to pages & updated .gitignore --- diff --git a/.gitignore b/.gitignore index 21d0b89..5ccf808 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ .venv/ +__pycache__/ +blog.egg-info/ +build/ diff --git a/blog.py b/blog.py index d28b5b3..94e603b 100755 --- a/blog.py +++ b/blog.py @@ -20,7 +20,8 @@ class Page(): keywords: list = ["Undefined"], date: str = "n.d.", content: str = "", - template: str = "page.html" + template: str = "page.html", + filename: str = "" ): self.title = title @@ -29,6 +30,7 @@ class Page(): self.date = date self.content = content self.template = template + self.filename = filename def from_metadata(self, metadata): if "title" in metadata: self.title = metadata["title"].title() @@ -47,7 +49,8 @@ class Page(): date = self.date, abstract = self.abstract, keywords = format_keywords, - content = self.content + content = self.content, + filename = self.filename ) return Response(page, mimetype="text/html") @@ -168,7 +171,7 @@ def generate_page(title): metadata = {k: v[0] for k, v in md.Meta.items()} md.reset() - page = Page(content = html) + page = Page(content = html, filename = title) page.from_metadata(metadata) return page.make() diff --git a/templates/page.html b/templates/page.html index 185bab7..5d4a74c 100644 --- a/templates/page.html +++ b/templates/page.html @@ -33,7 +33,10 @@

Abstract: {{abstract}}

{% endif %} {% if keywords %} -

Keywords: {{keywords|safe}}
See more keywords...

+

Keywords: {{keywords|safe}}
See more keywords...

+ {% endif %} + {% if filename %} +

See page history...

{% endif %}