Commit de23fd8882

de23fd88828d63f64f0a137b2fb6e87eaa7e1ce6

parent: 292bb65957

Unregistered key

cmc <hello@cleberg.net> · 2026-02-22 17:46 UTC
committer: <noreply@github.com>

fix: ensure .org filenames match .html filenames (#16)

Layout: unified · split

build.py +21 −1
@@ -272,7 +272,27 @@ def copy_org_sources(content_dir="./content", build_dir="./.build/org"):
272272 print(f"Copying org sources: {content_dir} → {build_dir}")
273273 if os.path.exists(build_dir):
274274 shutil.rmtree(build_dir)
275 shutil.copytree(content_dir, build_dir)
275
276 slug_pattern = re.compile(r"^#\+slug:\s*(.+)$", re.IGNORECASE)
277
278 for src_path in Path(content_dir).rglob("*.org"):
279 rel_dir = src_path.parent.relative_to(content_dir)
280 dest_dir = Path(build_dir) / rel_dir
281 dest_dir.mkdir(parents=True, exist_ok=True)
282
283 # Try to extract slug from file headers
284 slug = None
285 with src_path.open("r", encoding="utf-8") as f:
286 for line in f:
287 m = slug_pattern.match(line)
288 if m:
289 slug = m.group(1).strip()
290 break
291
292 dest_name = f"{slug}.org" if slug else src_path.name
293 shutil.copy2(src_path, dest_dir / dest_name)
294 if slug:
295 print(f" {src_path.name} → {dest_name}")
276296
277297
278298def generate_sitemap(build_dir=".build", base_url="https://cleberg.net"):