Fix relations nav_label URL bug and add rich 404 pages with headers

The relations container-nav fragment was inserting nav_label (e.g.
"calendars", "markets") as a URL path segment, generating wrong links
like /the-village-hall/markets/suma/ instead of /the-village-hall/suma/.
The nav_label is for display only, not URL construction.

Also adds a rich 404 handler that shows site headers and post breadcrumb
when a slug can be resolved from the URL path. Falls back gracefully to
the minimal error page if context building fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 18:30:44 +00:00
parent ee41e30d5b
commit 597b0d7a2f
2 changed files with 118 additions and 15 deletions

View File

@@ -78,10 +78,7 @@ def register():
slug = (child.metadata_ or {}).get("slug", "")
if not slug:
continue
nav_label = defn.nav_label or ""
if post_slug and nav_label:
path = f"/{post_slug}/{nav_label}/{slug}/"
elif post_slug:
if post_slug:
path = f"/{post_slug}/{slug}/"
else:
path = f"/{slug}/"