Skip to content

Commit

Permalink
Fix missing API navbar link when ApiPath has more than 1 segment
Browse files Browse the repository at this point in the history
  • Loading branch information
ociaw authored and daveaglick committed Dec 29, 2022
1 parent fe480ef commit 15c8841
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions input/Shared/_RightNavigation.cshtml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
@foreach(IDocument doc in OutputPages.GetChildrenOf("index.html")
.Where(x => x.GetBool(SiteKeys.ShowInNavigation, true))
.OrderBy(x => x.GetInt(Keys.Order)))
{
// Don't add the home page to the nav bar
if (doc.Destination != "index.html")
@{
String indexFileName = Context.Settings.GetIndexFileName();
foreach(IDocument doc in OutputPages.GetChildrenOf(indexFileName)
// Ensure the API path is added even if it's not a direct child of the root page
.Concat(OutputPages.Get(NormalizedPath.Combine(Context.GetPath(DocsKeys.ApiPath), indexFileName)))
.Where(x => x.GetBool(SiteKeys.ShowInNavigation, true))
// Ensure that duplicate API links aren't shown
.Distinct()
.OrderBy(x => x.GetInt(Keys.Order)))
{
<li class="nav-item">
@Html.DocumentLink(
Expand Down

0 comments on commit 15c8841

Please sign in to comment.