Skip to content

Commit 928fa93

Browse files
authored
Fix pages nav behaviour (#795)
* Fix pages nav behaviour * Refactor
1 parent 4101ba3 commit 928fa93

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/Elastic.Markdown/Slices/Layout/_TocTreeNav.cshtml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@
1212
{
1313
var f = file.File;
1414
<li class="flex group/li @(item.Depth == topLevelFile ? "font-semibold py-8 not-last:border-b-1 border-grey-20" : "ml-5 lg:ml-4 mt-4 lg:mt-3")">
15-
<a
16-
hx-get="@f.Url"
17-
hx-select-oob="@Htmx.GetHxSelectOob(f.RootNavigation.Id == Model.RootNavigationId)"
18-
hx-swap="none"
19-
hx-push-url="true"
20-
hx-indicator="#htmx-indicator"
21-
preload
22-
class="sidebar-link group-[.current]/li:text-blue-elastic!"
23-
id="page-@id"
24-
href="@f.Url">
25-
@f.NavigationTitle
26-
</a>
15+
<a
16+
href="@f.Url"
17+
@Htmx.GetHxAttributes(f.Url, !Model.IsPrimaryNavEnabled && f.RootNavigation.Id == Model.RootNavigationId)
18+
class="sidebar-link group-[.current]/li:text-blue-elastic!"
19+
id="page-@id"
20+
>
21+
@f.NavigationTitle
22+
</a>
2723
</li>
2824
}
2925
else if (item is GroupNavigation folder)
@@ -52,7 +48,7 @@
5248
</label>
5349
<a
5450
href="@(g.Index?.Url ?? "")"
55-
@Htmx.GetHxAttributes(g.Index?.Url ?? "", g.NavigationRootId == Model.RootNavigationId)
51+
@Htmx.GetHxAttributes(g.Index?.Url ?? "", !Model.IsPrimaryNavEnabled || g.NavigationRootId == Model.RootNavigationId)
5652
id="page-@(g.Index?.Id ?? id)"
5753
class="sidebar-link @(g.Depth == topLevelGroup ? "font-semibold font-sans mb-1 text-base" : "")">
5854
@(g.Index?.NavigationTitle ?? "Untitled")

0 commit comments

Comments
 (0)