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")