Skip to content

Commit 6cf9172

Browse files
miharpclaude
andcommitted
fix: handle absolute nav links without prepending collection base URL
Nav links starting with '/' are already absolute site paths. The old code unconditionally prepended nav_base (also starting with '/'), producing a double-prefix like /openvox/latest//openvox-server/latest/... and causing a 404. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
1 parent 807acdc commit 6cf9172

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

_includes/nav-item.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ <h2 class="text">{{ include.item.text }}</h2>
2828
</section>
2929
</div>
3030
{% elsif include.item.link %}
31-
{% assign nav_item_url = include.item.link | prepend: nav_base %}
31+
{%- comment -%}
32+
Links starting with '/' are already absolute site paths. Prepending nav_base (which also
33+
starts with '/') would produce a broken double-prefix like /openvox/latest//other/page.html.
34+
{%- endcomment -%}
35+
{% assign nav_link_first_char = include.item.link | slice: 0 %}
36+
{% if nav_link_first_char == '/' %}
37+
{% assign nav_item_url = include.item.link %}
38+
{% else %}
39+
{% assign nav_item_url = include.item.link | prepend: nav_base %}
40+
{% endif %}
3241

3342
<div class="VPSidebarItem level-{{ include.level }} is-link{% if nav_item_url == page.url %} is-active{% endif %}">
3443
<div class="item">

0 commit comments

Comments
 (0)