Fix post-row link on 404: inject Jinja globals into error context

base_context() doesn't include blog_url/cart_url/etc — those live in
Jinja globals. Without them call_url(ctx, "blog_url", ...) falls back
to a relative path instead of https://blog.rose-ash.com/...

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 18:47:03 +00:00
parent f1b7fdd37d
commit 97c4e25ba7

View File

@@ -94,6 +94,12 @@ async def _rich_error_page(errnum: str, message: str, image: str | None = None)
except Exception:
ctx = {"base_title": "Rose Ash", "asset_url": "/static"}
# Inject Jinja globals (blog_url, cart_url, etc.) — these are
# needed by call_url() for cross-subdomain links.
for key, val in current_app.jinja_env.globals.items():
if key not in ctx:
ctx[key] = val
# Try to fetch fragments, but don't fail if they're unreachable
try:
from shared.infrastructure.fragments import fetch_fragments