Commit 42bf4bae9d
42bf4bae9d582abd56758c1fcc7741419161fe7e
parent: 9049e20a29
Unsigned
cmc <hello@cleberg.net> · 2026-08-11 18:51 UTC
Route blog posts through post.html
The reply-by-email and Bubbles lines were emitted from base.html behind a test
on the page's URL, because org-ssg had no way for a page to pick a layout. It
does now, so they live in a post.html that extends the shared one — the same
split weblorg has between theme/templates/base.html and post.html — selected by
a [[pages]] rule for blog/.
All 169 posts carry the footer; /blog/ itself does not, being a generated
listing rather than a post.
Layout: unified · split
content/org-ssg.toml
+6
| @@ -34,6 +34,12 @@ pages = ["blog/index.html", "garden/index.html", "salary/index.org"] |
| 34 | [templates] |
34 | [templates] |
| 35 | dir = "templates" |
35 | dir = "templates" |
| 36 | |
36 | |
| |
37 | # Blog posts render through post.html — the shared layout plus a reply footer — the way |
| |
38 | # weblorg routes them through theme/templates/post.html. Everything else uses base.html. |
| |
39 | [[pages]] |
| |
40 | match = "blog" |
| |
41 | template = "post.html" |
| |
42 | |
| 37 | [highlight] |
43 | [highlight] |
| 38 | theme = "InspiredGitHub" |
44 | theme = "InspiredGitHub" |
| 39 | |
45 | |
content/templates/base.html
+2 −6
| @@ -57,13 +57,9 @@ |
| 57 | {%- if page.tags %} |
57 | {%- if page.tags %} |
| 58 | <p>{% for tag in page.tags %}<a href="{{ root }}tags/{{ tag }}.html">#{{ tag }}</a> {% endfor %}</p> |
58 | <p>{% for tag in page.tags %}<a href="{{ root }}tags/{{ tag }}.html">#{{ tag }}</a> {% endfor %}</p> |
| 59 | {%- endif %} |
59 | {%- endif %} |
| |
60 | {#- Blog posts add a reply footer inside this block; see post.html, which the |
| |
61 | [[pages]] rule in org-ssg.toml selects for everything under blog/. #} |
| 60 | <div>{% block content %}{{ body | safe }}{% endblock %}</div> |
62 | <div>{% block content %}{{ body | safe }}{% endblock %}</div> |
| 61 | {#- Blog posts carry a reply footer; other pages do not. org-ssg has no per-page |
| |
| 62 | template selection, so the page's own URL is what tells them apart. #} |
| |
| 63 | {%- if page.url is startingwith("blog/") %} |
| |
| 64 | <div><a href="mailto:hello@cleberg.net">Reply via email →</a></div> |
| |
| 65 | <div><i>...or, comment on this post on <a href="https://bubbles.town/source/cleberg.net">Bubbles</a>!</i></div> |
| |
| 66 | {%- endif %} |
| |
| 67 | </article> |
63 | </article> |
| 68 | {% endblock %} |
64 | {% endblock %} |
| 69 | </main> |
65 | </main> |
content/templates/post.html
added
+11
| @@ -0,0 +1,11 @@ |
| |
1 | {# A blog post, mirroring theme/templates/post.html. Everything but the reply footer is |
| |
2 | the shared layout, so this extends it rather than restating it. |
| |
3 | |
| |
4 | Selected by the [[pages]] rule for blog/ in org-ssg.toml; a post that wants a different |
| |
5 | layout says so with #+TEMPLATE:. #} |
| |
6 | {% extends "base.html" %} |
| |
7 | {% block content %} |
| |
8 | {{ body | safe }} |
| |
9 | <div><a href="mailto:hello@cleberg.net">Reply via email →</a></div> |
| |
10 | <div><i>...or, comment on this post on <a href="https://bubbles.town/source/cleberg.net">Bubbles</a>!</i></div> |
| |
11 | {% endblock %} |