From 15c884162f29d8e8036176b12a1dbbeb55e0c0b6 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Tue, 27 Dec 2022 00:23:42 -0900 Subject: [PATCH] Fix missing API navbar link when ApiPath has more than 1 segment --- input/Shared/_RightNavigation.cshtml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/input/Shared/_RightNavigation.cshtml b/input/Shared/_RightNavigation.cshtml index aed3140..1ee9ddf 100644 --- a/input/Shared/_RightNavigation.cshtml +++ b/input/Shared/_RightNavigation.cshtml @@ -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))) {