]> OzVa Git service - blog/commitdiff
Added git history to pages & updated .gitignore
authorMax Value <greenwoodw50@gmail.com>
Mon, 16 Dec 2024 13:53:24 +0000 (13:53 +0000)
committerMax Value <greenwoodw50@gmail.com>
Mon, 16 Dec 2024 13:53:24 +0000 (13:53 +0000)
.gitignore
blog.py
templates/page.html

index 21d0b898ff61470da684cc5e8f7d6efa648de8cf..5ccf808c8f81ac15b4909c86d78c2b9c931a9914 100644 (file)
@@ -1 +1,4 @@
 .venv/
+__pycache__/
+blog.egg-info/
+build/
diff --git a/blog.py b/blog.py
index d28b5b3930fe25a8da135d65b5af8a4dcdb7612a..94e603b9ef0411311818d48053fba3634753aa91 100755 (executable)
--- 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()
 
index 185bab7928b629fc5b58b633552a7584a988bd78..5d4a74ceab9966969c53793e1427c8f9faa2fc17 100644 (file)
                        <p>Abstract: <em>{{abstract}}</em></p>
                        {% endif %}
                        {% if keywords %}
-                       <p>Keywords: <em>{{keywords|safe}}<br><a href="/categories">See more keywords...</a></em></p>
+                       <p>Keywords: <em>{{keywords|safe}}<br><a href="/categories">See more keywords...</a></em><br></p>
+                       {% endif %}
+                       {% if filename %}
+                       <p><em><a href="https://git.ozva.co.uk/?p=blog;a=history;f=pages/{{filename|safe}}.md">See page history...</a></em></p>
                        {% endif %}
                        <hr>
                        <div>