diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs index 141fa337c4..a1bf656301 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -117,9 +117,16 @@ namespace Volo.Docs.Pages.Documents.Project { return Redirect(decodedUrl); } - var documentNameFallback = DocumentName ?? ""; + var documentPath = DocumentName ?? ""; - var documentNames = new[] { DocumentName, documentNameFallback.EnsureEndsWith('/') + "Index", documentNameFallback.EnsureEndsWith('/') + "index" }; + string[] documentNames; + + if (displayUrl.EndsWith("/index", StringComparison.OrdinalIgnoreCase)) + { + documentPath = documentPath.Substring(0, documentPath.LastIndexOf('/') + 1); + } + + documentNames = new[] { DocumentName, documentPath.EnsureEndsWith('/') + "Index", documentPath.EnsureEndsWith('/') + "index" }; foreach (var documentName in documentNames) {