robots.txt и sitemap.xml: поддержка HEAD (были 405 на HEAD-проверках валидаторов)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
berkio_admin_gitea
2026-07-08 07:21:03 +00:00
parent 5d226bdafc
commit 7ba8f78dd8

View File

@@ -849,7 +849,7 @@ async def favicon():
return FileResponse("/web_app/static/favicon.ico", media_type="image/x-icon") return FileResponse("/web_app/static/favicon.ico", media_type="image/x-icon")
@app.get("/robots.txt") @app.api_route("/robots.txt", methods=["GET", "HEAD"])
async def robots(): async def robots():
return HTMLResponse( return HTMLResponse(
content=( content=(
@@ -864,7 +864,7 @@ async def robots():
) )
@app.get("/sitemap.xml") @app.api_route("/sitemap.xml", methods=["GET", "HEAD"])
async def sitemap(): async def sitemap():
today = datetime.date.today().isoformat() today = datetime.date.today().isoformat()
# Все языковые страницы + перекрёстные hreflang-альтернативы (xhtml:link) # Все языковые страницы + перекрёстные hreflang-альтернативы (xhtml:link)