Commit 49c030d83f

49c030d83f2b56507825304fe7b6a1e862b1843c

parent: 9ed1f35adf

Verified · cmc ci/build: failure ci/lint: success

cmc <hello@cleberg.net> · 2026-08-31 03:37 UTC

Use a placeholder for the footer version, and trim comments

Layout: unified · split

README.md −4
@@ -129,10 +129,6 @@ orgo can also build and preview on its own, without `build.py`:
129129orgo serve content -o /tmp/preview
130130```
131131
132Such a preview skips the footer rewrite, so it prints whatever version
133`content/templates/base.html` currently hardcodes rather than the one that
134built it.
135
136132## Deployment
137133
138134Production builds rewrite image URLs to root-relative ones
build.py +5 −8
@@ -78,10 +78,9 @@ def rewrite_img_urls(build_dir=".build"):
7878 print(f"Rewrote {count} img.cleberg.net references to /img/")
7979
8080
81# The footer's "Powered by orgo <version>" note. Anchored on the whole phrase rather
82# than on a placeholder token, so the template stays valid HTML on its own and a page
83# already carrying a version is rewritten the same way as a freshly rendered one — and
84# so prose that happens to end a paragraph with a link to orgo is left alone.
81# The footer's "Powered by orgo <version>" note. Matching the whole phrase rewrites a
82# page carrying an old version as readily as one still carrying the template's
83# placeholder, and leaves prose that ends a paragraph with a link to orgo alone.
8584ORGO_NOTE = re.compile(
8685 r'(Powered by <a href="https://gitbay\.org/krz/orgo">orgo</a> )[^<]*(</p>)'
8786)
@@ -115,8 +114,8 @@ def rewrite_orgo_version(build_dir):
115114
116115 The whole point of this is that the note cannot go stale, so a footer that no longer
117116 matches is a failure and not a no-op — matching nothing anywhere means the note was
118 removed or its markup changed, and a silent pass would leave the site claiming
119 whatever the template last hardcoded.
117 removed or its markup changed, and a silent pass would ship the template's
118 placeholder to every page.
120119 """
121120 version = orgo_version()
122121 count = 0
@@ -223,8 +222,6 @@ def main():
223222
224223 if os.environ.get("BUILD", "").casefold() == "true":
225224 run_orgo_build(build_dir)
226 # Both environments: a dev preview showing a stale version is the same defect
227 # as a deployed page showing one.
228225 rewrite_orgo_version(build_dir)
229226 # The onion needs same-origin images; dev previews keep the absolute URLs.
230227 # Runs over every page, not just the re-rendered ones, so a page carried over
content/templates/base.html +1 −4
@@ -93,10 +93,7 @@
9393<a href="{{ root }}tips/index.html">Tips</a> &middot;
9494<a href="https://iheartrss.com/">I &hearts; RSS</a>
9595<p>[ <a href="https://krz.sh">krz</a> &middot; <a href="https://audit-labs.dev">audit labs</a> ]</p>
96{#- The version is rewritten in the built HTML by build.py, which reads it from the
97 orgo that just ran. What is written here is the seed and the fallback: a build
98 that bypasses build.py (`orgo serve`) prints it as-is. #}
99<p>Powered by <a href="https://gitbay.org/krz/orgo">orgo</a> 0.22.0</p>
96<p>Powered by <a href="https://gitbay.org/krz/orgo">orgo</a> ORGO_VERSION</p>
10097</footer>
10198</body>
10299</html>