This repository has been archived on 2026-02-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blog/templates/fragments/nav_tree.html
giles e5b02f1c44
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m6s
Restore menu_items fallback, fix app slug URLs in nav fragment
Keep get_navigation_tree() as fallback when nav-tree fragment fetch
fails. Also map all app slugs (market, events, federation, account)
to their proper cross-app URLs in the nav fragment template.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 11:49:20 +00:00

33 lines
1.3 KiB
HTML

{# Nav-tree fragment — rendered by blog, consumed by all apps.
Uses frag_app_name / frag_first_seg instead of request.path / app_name
so the consuming app's context is reflected correctly.
No hx-boost — cross-app nav links are full page navigations. #}
{% set _app_slugs = {
'cart': cart_url('/'),
'market': market_url('/'),
'events': events_url('/'),
'federation': federation_url('/'),
'account': account_url('/'),
} %}
<div class="flex flex-col sm:flex-row sm:items-center gap-2 border-r border-stone-200 mr-2 sm:max-w-2xl"
id="menu-items-nav-wrapper">
{% from 'macros/scrolling_menu.html' import scrolling_menu with context %}
{% call(item) scrolling_menu('menu-items-container', menu_items) %}
{% set _href = _app_slugs.get(item.slug, blog_url('/' + item.slug + '/')) %}
<a
href="{{ _href }}"
aria-selected="{{ 'true' if (item.slug == frag_first_seg or item.slug == frag_app_name) else 'false' }}"
class="{{styles.nav_button_less_pad}}"
>
{% if item.feature_image %}
<img src="{{ item.feature_image }}"
alt="{{ item.label }}"
class="w-8 h-8 rounded-full object-cover flex-shrink-0" />
{% else %}
<div class="w-8 h-8 rounded-full bg-stone-200 flex-shrink-0"></div>
{% endif %}
<span>{{ item.label }}</span>
</a>
{% endcall %}
</div>