Skip to content

Commit 75e7beb

Browse files
committed
Fix navigation.
1 parent c6c3327 commit 75e7beb

File tree

7 files changed

+13
-20
lines changed

7 files changed

+13
-20
lines changed

docs/input/dap.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Title: Debug Adapter Protocol
22
ShowInSidebar: true
3+
Order: 3
34
---

docs/input/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ Title: C# Language Server Protocol
22
NoSidebar: false
33
ShowInSidebar: false
44
NoTitle: true
5-
ArchiveSources: '*.md'
6-
ArchiveOrderDescending: true
75
---
86

97
# Welcome!

docs/input/jsonrpc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Title: JSON RPC
22
ShowInSidebar: true
3+
Order: 2
34
---
45

56
# Using Json Rpc Standalone

docs/input/lsp.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Title: Language Server Protocol
22
ShowInSidebar: true
3+
Order: 1
34
---
45

56
# Implementing the Language Server Protocol

docs/input/source-generation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Title: Source Generators
22
ShowInSidebar: true
3+
Order: 4
34
---
45

56
# Source Generators

docs/theme/input/Shared/Sidebar/_ChildPages.cshtml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
@{
2-
// Get the root
3-
IDocumentPathTree<IDocument> tree = Outputs.AsSourceTree();
4-
IDocument root = Document;
5-
IDocument parent = tree.GetParentOf(root);
6-
while(parent != null)
7-
{
8-
root = parent;
9-
parent = tree.GetParentOf(root);
10-
}
2+
IDocument root = OutputPages[Document.Destination.ChangeFileName("index.html").FullPath].First();
113

124
// Display the menu
13-
IReadOnlyList<IDocument> children = root.GetDocumentList(Keys.Children);
5+
DocumentList<IDocument> children = OutputPages.GetChildrenOf(root)
6+
.Where(x => x.GetBool(SamsonKeys.ShowInSidebar))
7+
.ToDocumentList();
8+
149
if(children != null && children.Count > 0)
1510
{
1611
@Html.Partial("Sidebar/_ChildPagesMenu", children)

docs/theme/input/Shared/Sidebar/_ChildPagesMenu.cshtml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@inherits Statiq.Razor.StatiqRazorPage<IReadOnlyList<IDocument>>
1+
@inherits Statiq.Razor.StatiqRazorPage<DocumentList<IDocument>>
22

33
@{
44
// Group by category
@@ -19,13 +19,9 @@
1919
.OrderBy(x => x.Get<int>(SamsonKeys.Order, 1000))
2020
.ThenBy(x => x.WithoutSettings().GetString(Keys.Title)))
2121
{
22-
//object[] currentTreePath = /Document.Get<object[]>(Keys.TreePath);
23-
//object[] childTreePath = child.Get<object[]>(Keys.TreePath);
24-
//string childTitle = child.WithoutSettings().GetString(Keys.Title, childTreePath.Last().ToString());
25-
//string parentActive = currentTreePath.Take(childTreePath.Length).SequenceEqual(childTreePath) ? "active" : null;
26-
//string childSelected = parentActive != null && currentTreePath.Length == childTreePath.Length ? "selected" : null;
27-
string parentActive = "active";
28-
string childSelected = "selected";
22+
// TODO: this doesn't take into account if a child is active.
23+
string? parentActive = Document.IdEquals(child) ? "active" : null;
24+
string? childSelected = Document.IdEquals(child) ? "selected" : null;
2925
string childTitle = child.GetTitle();
3026
IReadOnlyList<IDocument> children = child.GetDocumentList(Keys.Children);
3127
if (children != null && children.Count > 0)

0 commit comments

Comments
 (0)