diff options
author | github-actions <41898282+github-actions[bot]@users.noreply.github.com> | 2025-07-14 21:05:08 +0000 |
---|---|---|
committer | github-actions <41898282+github-actions[bot]@users.noreply.github.com> | 2025-07-14 21:05:08 +0000 |
commit | a6995926c0b1f22f5713be5ce8d78fd0a523bc6f (patch) | |
tree | bafa35eec53cce3d5e3315b90bd5549f6ca85c28 | |
parent | df3d97393c431c86075922ef09873d7f89b13dc1 (diff) | |
download | cleberg.net-a6995926c0b1f22f5713be5ce8d78fd0a523bc6f.tar.gz cleberg.net-a6995926c0b1f22f5713be5ce8d78fd0a523bc6f.tar.bz2 cleberg.net-a6995926c0b1f22f5713be5ce8d78fd0a523bc6f.zip |
Commit from GitHub Actions (Ruff)
-rw-r--r-- | build.py | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -281,14 +281,16 @@ def generate_sitemap(public_dir="public", base_url="https://cleberg.net"): rel_path = os.path.relpath(full_path, public_dir) url_path = "/" + quote(rel_path.replace(os.sep, "/")) # Remove index.html for cleaner URLs - if url_path.endswith('/index.html'): - url_path = url_path[:-10] or '/' - elif url_path == '/index.html': - url_path = '/' + if url_path.endswith("/index.html"): + url_path = url_path[:-10] or "/" + elif url_path == "/index.html": + url_path = "/" loc = f"{base_url}{url_path}" # Last modified time - lastmod = datetime.utcfromtimestamp(os.path.getmtime(full_path)).strftime("%Y-%m-%d") + lastmod = datetime.utcfromtimestamp( + os.path.getmtime(full_path) + ).strftime("%Y-%m-%d") sitemap_entries.append(f""" <url> <loc>{loc}</loc> @@ -304,7 +306,9 @@ def generate_sitemap(public_dir="public", base_url="https://cleberg.net"): sitemap_path = os.path.join(public_dir, "sitemap.xml") with open(sitemap_path, "w", encoding="utf-8") as f: f.write(sitemap_xml) - print(f"Sitemap generated at {sitemap_path} with {len(sitemap_entries)} entries.") + print( + f"Sitemap generated at {sitemap_path} with {len(sitemap_entries)} entries." + ) def deploy_to_server(build_dir, server): |