Commit ded44ca9e8

ded44ca9e8363a32773de795e61c77afd174b333

parent: faf7486902

Unsigned

github-actions <41898282+github-actions[bot]@users.noreply.github.com> · 2025-07-14 21:05 UTC

Commit from GitHub Actions (Ruff)

Layout: unified · split

build.py +10 −6
@@ -281,14 +281,16 @@ def generate_sitemap(public_dir="public", base_url="https://cleberg.net"):
281 rel_path = os.path.relpath(full_path, public_dir) 281 rel_path = os.path.relpath(full_path, public_dir)
282 url_path = "/" + quote(rel_path.replace(os.sep, "/")) 282 url_path = "/" + quote(rel_path.replace(os.sep, "/"))
283 # Remove index.html for cleaner URLs 283 # Remove index.html for cleaner URLs
284 if url_path.endswith('/index.html'): 284 if url_path.endswith("/index.html"):
285 url_path = url_path[:-10] or '/' 285 url_path = url_path[:-10] or "/"
286 elif url_path == '/index.html': 286 elif url_path == "/index.html":
287 url_path = '/' 287 url_path = "/"
288 loc = f"{base_url}{url_path}" 288 loc = f"{base_url}{url_path}"
289 289
290 # Last modified time 290 # Last modified time
291 lastmod = datetime.utcfromtimestamp(os.path.getmtime(full_path)).strftime("%Y-%m-%d") 291 lastmod = datetime.utcfromtimestamp(
292 os.path.getmtime(full_path)
293 ).strftime("%Y-%m-%d")
292 294
293 sitemap_entries.append(f""" <url> 295 sitemap_entries.append(f""" <url>
294 <loc>{loc}</loc> 296 <loc>{loc}</loc>
@@ -304,7 +306,9 @@ def generate_sitemap(public_dir="public", base_url="https://cleberg.net"):
304 sitemap_path = os.path.join(public_dir, "sitemap.xml") 306 sitemap_path = os.path.join(public_dir, "sitemap.xml")
305 with open(sitemap_path, "w", encoding="utf-8") as f: 307 with open(sitemap_path, "w", encoding="utf-8") as f:
306 f.write(sitemap_xml) 308 f.write(sitemap_xml)
307 print(f"Sitemap generated at {sitemap_path} with {len(sitemap_entries)} entries.") 309 print(
310 f"Sitemap generated at {sitemap_path} with {len(sitemap_entries)} entries."
311 )
308 312
309 313
310def deploy_to_server(build_dir, server): 314def deploy_to_server(build_dir, server):