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 0ffa883d8d..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,18 +117,32 @@ namespace Volo.Docs.Pages.Documents.Project { return Redirect(decodedUrl); } - try + var documentPath = DocumentName ?? ""; + + string[] documentNames; + + if (displayUrl.EndsWith("/index", StringComparison.OrdinalIgnoreCase)) { - return await SetPageAsync(); + documentPath = documentPath.Substring(0, documentPath.LastIndexOf('/') + 1); } - catch (DocumentNotFoundException exception) - { - Logger.LogWarning(exception.Message); - DocumentFound = false; - Response.StatusCode = 404; - return Page(); + documentNames = new[] { DocumentName, documentPath.EnsureEndsWith('/') + "Index", documentPath.EnsureEndsWith('/') + "index" }; + + foreach (var documentName in documentNames) + { + DocumentName = documentName; + try + { + return await SetPageAsync(); + } + catch (DocumentNotFoundException exception) + { + Logger.LogWarning(exception.Message); + } } + DocumentFound = false; + Response.StatusCode = 404; + return Page(); } private async Task SetPageAsync()