From 0b08dc51c6693e0a9c400c61eba3606027b49dfe Mon Sep 17 00:00:00 2001 From: AIIrondev Date: Mon, 27 Apr 2026 20:51:33 +0200 Subject: [PATCH] feat: Add health check endpoint, SEO meta tags, and sitemap/robots support for improved site visibility and functionality Co-authored-by: Copilot --- Website/main.py | 41 +++++++++++++++++++++++++++++++++++++ Website/static/robots.txt | 5 +++++ Website/static/sitemap.xml | 8 ++++++++ Website/templates/base.html | 14 +++++++++++++ Website/templates/main.html | 18 ++++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 Website/static/robots.txt create mode 100644 Website/static/sitemap.xml diff --git a/Website/main.py b/Website/main.py index 7ca1db9..880037d 100644 --- a/Website/main.py +++ b/Website/main.py @@ -1615,6 +1615,47 @@ def default(): return render_template("main.html") +@app.route('/health') +def health(): + return jsonify({"status": "ok", "time": _utc_now_iso()}), 200 + + +@app.route('/robots.txt') +def robots_txt(): + path = os.path.join(BASE_DIR, 'static', 'robots.txt') + if os.path.exists(path): + return send_file(path, mimetype='text/plain') + return ( + "User-agent: *\nDisallow: /admin/\nAllow: /\nSitemap: /sitemap.xml\n", + 200, + {"Content-Type": "text/plain"}, + ) + + +@app.route('/sitemap.xml') +def sitemap_xml(): + site_root = request.url_root.rstrip('/') + sitemap_path = os.path.join(BASE_DIR, 'static', 'sitemap.xml') + if os.path.exists(sitemap_path): + try: + with open(sitemap_path, 'r', encoding='utf-8') as fh: + content = fh.read().replace('{{ SITE_ROOT }}', site_root) + return app.response_class(content, mimetype='application/xml') + except Exception: + pass + xml = ( + '\n' + '\n' + ' \n' + f' {site_root}\n' + ' daily\n' + ' 1.0\n' + ' \n' + '' + ) + return app.response_class(xml, mimetype='application/xml') + + @app.route('/dienstleistungen') def dienstleistungen(): return render_template("dienstleistungen.html") diff --git a/Website/static/robots.txt b/Website/static/robots.txt new file mode 100644 index 0000000..24370cb --- /dev/null +++ b/Website/static/robots.txt @@ -0,0 +1,5 @@ +User-agent: * +Disallow: /admin/ +Disallow: /static/uploads/ +Allow: / +Sitemap: /sitemap.xml diff --git a/Website/static/sitemap.xml b/Website/static/sitemap.xml new file mode 100644 index 0000000..91fa7bd --- /dev/null +++ b/Website/static/sitemap.xml @@ -0,0 +1,8 @@ + + + + {{ SITE_ROOT }} + daily + 1.0 + + diff --git a/Website/templates/base.html b/Website/templates/base.html index 885d7a5..558e585 100644 --- a/Website/templates/base.html +++ b/Website/templates/base.html @@ -8,6 +8,20 @@ {% block title %}Digitale Schulverwaltung{% endblock %} + {# Basic SEO meta tags, can be overridden per-template by setting `meta_description` #} + + + + + + + + + + + + + {% block head %} diff --git a/Website/templates/main.html b/Website/templates/main.html index 660daac..29f0891 100644 --- a/Website/templates/main.html +++ b/Website/templates/main.html @@ -1,5 +1,8 @@ {% extends "base.html" %} +{# SEO: per-page description used in base.html meta tags #} +{% set meta_description = "Invario bündelt Lehrmittelverwaltung, Inventar und Ausleihe für Schulen – sicher, transparent und einfach zu bedienen." %} + {% block title %}Digitale Schulverwaltung mit Sicherheitsfokus{% endblock %} {% block head %} @@ -550,6 +553,21 @@ {% endblock %} {% block content %} +
Lehrmittelverwaltungssoftware für Schulen