Skip to content

Commit 15c8841

Browse files
ociawdaveaglick
authored andcommitted
Fix missing API navbar link when ApiPath has more than 1 segment
1 parent fe480ef commit 15c8841

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

input/Shared/_RightNavigation.cshtml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
@foreach(IDocument doc in OutputPages.GetChildrenOf("index.html")
2-
.Where(x => x.GetBool(SiteKeys.ShowInNavigation, true))
3-
.OrderBy(x => x.GetInt(Keys.Order)))
4-
{
5-
// Don't add the home page to the nav bar
6-
if (doc.Destination != "index.html")
1+
@{
2+
String indexFileName = Context.Settings.GetIndexFileName();
3+
foreach(IDocument doc in OutputPages.GetChildrenOf(indexFileName)
4+
// Ensure the API path is added even if it's not a direct child of the root page
5+
.Concat(OutputPages.Get(NormalizedPath.Combine(Context.GetPath(DocsKeys.ApiPath), indexFileName)))
6+
.Where(x => x.GetBool(SiteKeys.ShowInNavigation, true))
7+
// Ensure that duplicate API links aren't shown
8+
.Distinct()
9+
.OrderBy(x => x.GetInt(Keys.Order)))
710
{
811
<li class="nav-item">
912
@Html.DocumentLink(

0 commit comments

Comments
 (0)