From 991e250f539747e265352d484934694a7103bb1c Mon Sep 17 00:00:00 2001 From: elpatron Date: Mon, 23 Feb 2026 12:47:21 +0100 Subject: [PATCH] =?UTF-8?q?SEO-Metatags=20&=20sitemap.xml=20hinzugef=C3=BC?= =?UTF-8?q?gt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- app.py | 17 +++++++++++++++++ templates/index.html | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/app.py b/app.py index ff4e0d9..81a49ee 100644 --- a/app.py +++ b/app.py @@ -99,6 +99,22 @@ def calendar_ics() -> Response: ) +@app.route("/sitemap.xml") +def sitemap() -> Response: + """Einfache Sitemap mit den wichtigsten URLs der Anwendung.""" + base = PUBLIC_URL or request.url_root.rstrip("/") + urls = [f"{base}/", f"{base}/calendar.ics"] + body = [ + '', + '', + ] + for u in urls: + body.append(f" {u}") + body.append("") + xml = "\n".join(body) + "\n" + return Response(xml, mimetype="application/xml") + + def _format_last_refresh() -> str | None: """Zeitpunkt der letzten Aktualisierung formatiert (z. B. 29.01.2025, 14:32 Uhr).""" with _cache_lock: @@ -136,6 +152,7 @@ def index(): calendar_url=calendar_url, last_refresh_str=last_refresh_str, upcoming_days=upcoming_days, + base_url=base, ) except Exception as e: _log.exception("Template index.html: %s", e) diff --git a/templates/index.html b/templates/index.html index 0fe49b3..2c0f591 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,6 +4,15 @@ Speiseplan Kantine BHZ Kiel-Wik – iCal-Abo + + + + + + + + +