diff options
| author | alex <alex@pdp7.net> | 2023-10-23 20:44:45 +0200 |
|---|---|---|
| committer | alex <alex@pdp7.net> | 2023-10-23 20:44:45 +0200 |
| commit | 586b99be4f877077ad4dec517bb33a7aaab7c71d (patch) | |
| tree | 62b2e9f24ac999d74da3b1a9ba7dd4f125316314 | |
| parent | 0d0a02889e9a2181b9a4a46fe0f0988115261186 (diff) | |
Minimize a bit HTML blog entry page
| -rw-r--r-- | blog/blog/blog_pages.py | 3 | ||||
| -rw-r--r-- | blog/blog/html.py | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/blog/blog/blog_pages.py b/blog/blog/blog_pages.py index 881ee7c7..42051c7f 100644 --- a/blog/blog/blog_pages.py +++ b/blog/blog/blog_pages.py @@ -81,7 +81,7 @@ class Root(page.BasePage): return ( bicephalus.Status.OK, "text/html", - html.html_template(*itertools.chain(posts)), + html.html_template(*itertools.chain(posts), full=True), ) def feed(self): @@ -135,5 +135,6 @@ class EntryPage(page.BasePage): html.html_template( *self.entry.html(), page_title=f"{self.entry.title} - {self.entry.posted}", + full=False, ), ) diff --git a/blog/blog/html.py b/blog/blog/html.py index 8aa92f4a..ca3e8e04 100644 --- a/blog/blog/html.py +++ b/blog/blog/html.py @@ -5,7 +5,7 @@ import htmlgenerator as h from blog import meta, pretty, gemtext -def html_template(*content, page_title=None): +def html_template(*content, page_title=None, full): title = [h.A(meta.TITLE, href=f"{meta.SCHEMA}://{meta.HOST}")] if page_title: title += f" - {page_title}" @@ -16,6 +16,13 @@ def html_template(*content, page_title=None): links += h.BaseElement(f" {meta.EMAIL_TEXT}") + full_part = [] + if full: + full_part = [ + h.H2(meta.SUBTITLE), + h.P(*links), + ] + return pretty.pretty_html(h.render( h.HTML( h.HEAD( @@ -24,8 +31,7 @@ def html_template(*content, page_title=None): ), h.BODY( h.H1(title), - h.H2(meta.SUBTITLE), - h.P(*links), + *full_part, *content, ), doctype="html", |
