Add external flag to menu-row for cross-subdomain links

Cross-subdomain hx-get breaks due to OAuth redirects. When external=true,
menu-row renders a plain <a href> without HTMX attributes, allowing
normal browser navigation.

Applied to post header links on events and market services which link
back to blog.rose-ash.com.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 16:46:47 +00:00
parent 6a331e4ad8
commit a8edc26a1d
3 changed files with 9 additions and 7 deletions

View File

@@ -61,7 +61,8 @@ def _post_header_html(ctx: dict, *, oob: bool = False) -> str:
return render("menu-row", id="post-row", level=1,
link_href=link_href, link_label_html=label_html,
nav_html=nav_html, child_id="post-header-child", oob=oob)
nav_html=nav_html, child_id="post-header-child", oob=oob,
external=True)
def _post_nav_html(ctx: dict) -> str:

View File

@@ -99,6 +99,7 @@ def _post_header_html(ctx: dict, *, oob: bool = False) -> str:
id="post-row", level=1,
link_href=link_href, link_label_html=label_html,
nav_html=nav_html, child_id="post-header-child", oob=oob,
external=True,
)

View File

@@ -120,7 +120,7 @@
(when auth-menu-html (raw! auth-menu-html)))))
(defcomp ~menu-row (&key id level colour link-href link-label link-label-html icon
hx-select nav-html child-id child-html oob)
hx-select nav-html child-id child-html oob external)
(let* ((c (or colour "sky"))
(lv (or level 1))
(shade (str (- 500 (* lv 100)))))
@@ -130,11 +130,11 @@
:class (str "flex flex-col items-center md:flex-row justify-center md:justify-between w-full p-1 bg-" c "-" shade)
(div :class "relative nav-group"
(a :href link-href
:hx-get link-href
:hx-target "#main-panel"
:hx-select (or hx-select "#main-panel")
:hx-swap "outerHTML"
:hx-push-url "true"
:hx-get (if external nil link-href)
:hx-target (if external nil "#main-panel")
:hx-select (if external nil (or hx-select "#main-panel"))
:hx-swap (if external nil "outerHTML")
:hx-push-url (if external nil "true")
:class "w-full whitespace-normal flex items-center gap-2 font-bold text-2xl px-3 py-2"
(when icon (i :class icon :aria-hidden "true"))
(if link-label-html (raw! link-label-html)