diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml index 2167119a0d..fdb974e292 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml @@ -16,6 +16,7 @@ @using Volo.Abp.AspNetCore.Mvc.UI.Theming @using Volo.Docs @using Volo.Docs.Areas.Documents.TagHelpers +@using Volo.Docs.Documents @using Volo.Docs.Localization @using Volo.Docs.Pages.Documents.Project @using Volo.Docs.Pages.Documents.Shared.ErrorComponent @@ -292,6 +293,73 @@ + @if (Model.Navigation != null && Model.Navigation.Items != null) + { + var currentNode = Model.Navigation.Items.FirstOrDefault(n => n.IsSelected(Model.DocumentNameWithExtension)); + var navigation = Model.Navigation.FindNavigation(Model.DocumentNameWithExtension); + var documentExtension = System.IO.Path.GetExtension(Model.DocumentNameWithExtension); + NavigationNode previousNode = null; + if (currentNode != null) + { + while (currentNode != null) + { + if (!string.IsNullOrWhiteSpace(currentNode.Path) && previousNode != currentNode) + { + previousNode = currentNode; + PrintNode(currentNode); + } + else + { + var indexDocument = FindIndexNode(currentNode); + if (indexDocument != null && indexDocument != previousNode) + { + PrintNode(indexDocument, currentNode.Text); + } + else if(currentNode != previousNode) + { + + } + + previousNode = indexDocument; + } + + currentNode = currentNode?.Items?.FirstOrDefault(n => n.IsSelected(Model.DocumentNameWithExtension)); + } + } + + void PrintNode(NavigationNode node, string text = null) + { + var extension = System.IO.Path.GetExtension(node.Path); + var path = string.IsNullOrWhiteSpace(extension) ? node.Path : node.Path.Substring(0, node.Path.Length - extension.Length); + + } + + NavigationNode FindIndexNode(NavigationNode node) + { + var nextNode = node.Items?.FirstOrDefault(n => n.IsSelected(Model.DocumentNameWithExtension)); + while (nextNode != null && string.IsNullOrEmpty(nextNode.Path)) + { + nextNode = nextNode.Items.FirstOrDefault(n => n.IsSelected(Model.DocumentNameWithExtension)); + } + + if(nextNode == null) + { + return node.Items?.FirstOrDefault(n => n.Text == "Overview"); + } + + var lastSlashIndex = nextNode.Path.LastIndexOf('/'); + var path = lastSlashIndex < 0 ? nextNode.Path : nextNode.Path.Substring(0, lastSlashIndex); + return node.Items.FirstOrDefault(n => n.Path != null && (n.IsSelected(path + documentExtension) || n.IsSelected(path + "/index" + documentExtension))) ?? node.Items.FirstOrDefault(n => n.Text == "Overview"); + } + }
diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js index fef573f413..41896bb2fd 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js @@ -279,8 +279,6 @@ initSocialShareLinks(); initSections(); - - initDocumentNodeBreadcrumb(); Element.prototype.querySelector = function (selector) { var result = $(this).find(decodeURI(selector));