robots.txt и sitemap.xml: поддержка HEAD (были 405 на HEAD-проверках валидаторов)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user