Commit 37ae034013

37ae0340134d692c02621a365768dc8a7cbae109

parent: 8c8c09b13e

Unsigned

cmc <hello@cleberg.net> · 2025-06-04 01:15 UTC

fix: move dynamic updates to .build dir

Layout: unified · split

build.py +7 −2
@@ -8,7 +8,7 @@ from pathlib import Path
8from datetime import datetime 8from datetime import datetime
9 9
10 10
11def update_index_html(html_snippet, template_path="./theme/templates/index.html"): 11def update_index_html(html_snippet, template_path="./.build/index.html"):
12 """ 12 """
13 Read the index.html file at `template_path`, replace everything between 13 Read the index.html file at `template_path`, replace everything between
14 <!-- BEGIN_POSTS --> and <!-- END_POSTS --> with the provided html_snippet, 14 <!-- BEGIN_POSTS --> and <!-- END_POSTS --> with the provided html_snippet,
@@ -255,7 +255,6 @@ def start_dev_server(build_dir):
255 255
256def main(): 256def main():
257 html_snippet = get_recent_posts_html("./content/blog", num_posts=3) 257 html_snippet = get_recent_posts_html("./content/blog", num_posts=3)
258 update_index_html(html_snippet)
259 258
260 build_dir = Path(".build") 259 build_dir = Path(".build")
261 theme_dir = Path("theme/static") 260 theme_dir = Path("theme/static")
@@ -283,6 +282,9 @@ def main():
283 # Run publishing script (silenced output) 282 # Run publishing script (silenced output)
284 run_emacs_publish(dev_mode=False) 283 run_emacs_publish(dev_mode=False)
285 284
285 # Update index page with latest posts
286 update_index_html(html_snippet)
287
286 # Deploy changes 288 # Deploy changes
287 deploy_to_server(build_dir, homelab_server) 289 deploy_to_server(build_dir, homelab_server)
288 290
@@ -298,6 +300,9 @@ def main():
298 # Run publishing script (with console output) 300 # Run publishing script (with console output)
299 run_emacs_publish(dev_mode=True) 301 run_emacs_publish(dev_mode=True)
300 302
303 # Update index page with latest posts
304 update_index_html(html_snippet)
305
301 # Launch development web server 306 # Launch development web server
302 start_dev_server(build_dir) 307 start_dev_server(build_dir)
303 308