From 61f1338405d44a8b84150669b6334698c9477467 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Fri, 15 May 2026 15:42:49 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20SEO=20=E2=80=94=20meta=20tags,=20keywor?= =?UTF-8?q?ds,=20SSR=20vendors,=20robots.txt,=20sitemap.xml,=20Schema.org?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/index.html | 40 ++++++++++++++++++++++++++++++++++++++-- zkart_app/routes.py | 42 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/templates/index.html b/templates/index.html index a7faecd..4e27c36 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,12 +3,39 @@ - Корзина МОНТ + Вендоры МОНТ — матрица продуктов и категорий дистрибьютора MONT + + + + + + + + + + + + + + + + - +
@@ -34,6 +61,15 @@ + + +

Вендоры

...
diff --git a/zkart_app/routes.py b/zkart_app/routes.py index 0f39473..aff72d4 100644 --- a/zkart_app/routes.py +++ b/zkart_app/routes.py @@ -548,7 +548,47 @@ def apply_pending_overlay( @bp.get("/") def index(): - return render_template("index.html") + conn = get_db() + ssr_vendors = [r[0] for r in conn.execute("SELECT name FROM vendors ORDER BY lower(name)")] + ssr_categories = [r[0] for r in conn.execute( + "SELECT name FROM (SELECT name FROM categories UNION SELECT name FROM ib_categories) ORDER BY lower(name)" + )] + conn.close() + proto = request.headers.get("X-Forwarded-Proto", "https") + canonical_url = f"{proto}://{request.host}" + return render_template("index.html", + ssr_vendors=ssr_vendors, + ssr_categories=ssr_categories, + canonical_url=canonical_url, + ) + + +@bp.get("/robots.txt") +def robots_txt(): + from flask import Response + body = ( + "User-agent: *\n" + "Allow: /\n" + f"Disallow: {ADMIN_PATH}\n" + "Disallow: /sdjlkfhsjkadahjksdhjgfkhsssssdjkjfljsdfjklsdajfkldsjflksdjfkldsj\n" + "\n" + f"Sitemap: https://{{host}}/sitemap.xml\n" + ).replace("{host}", request.host) + return Response(body, mimetype="text/plain") + + +@bp.get("/sitemap.xml") +def sitemap_xml(): + from flask import Response + proto = request.headers.get("X-Forwarded-Proto", "https") + base = f"{proto}://{request.host}" + body = ( + '\n' + '\n' + f' {base}/weekly1.0\n' + '' + ) + return Response(body, mimetype="application/xml") @bp.get("/api/data")