Browse Source

docs "documents/" prefix optional

pull/1192/head
Yunus Emre Kalkan 7 years ago
parent
commit
12a1301b57
  1. 3
      modules/docs/app/VoloDocs.Web/appsettings.json
  2. 14
      modules/docs/src/Volo.Docs.Web/DocsWebModule.cs

3
modules/docs/app/VoloDocs.Web/appsettings.json

@ -1,5 +1,6 @@
{
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true",
"Title": "VoloDocs",
"LogoUrl": "/assets/images/Logo.png"
"LogoUrl": "/assets/images/Logo.png",
"IncludeDocumentPrefixInUrl": "true"
}

14
modules/docs/src/Volo.Docs.Web/DocsWebModule.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using System;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
@ -35,12 +36,15 @@ namespace Volo.Docs
options.FileSets.AddEmbedded<DocsWebModule>("Volo.Docs");
});
var configuration = context.Services.GetConfiguration();
Configure<RazorPagesOptions>(options =>
{
//TODO: Make configurable!
options.Conventions.AddPageRoute("/Documents/Project/Index", "documents/{projectName}");
options.Conventions.AddPageRoute("/Documents/Project/Index", "documents/{languageCode}/{projectName}");
options.Conventions.AddPageRoute("/Documents/Project/Index", "documents/{languageCode}/{projectName}/{version}/{*documentName}");
var prefix = Convert.ToBoolean(configuration["IncludeDocumentPrefixInUrl"]) ? "documents/" : "";
options.Conventions.AddPageRoute("/Documents/Project/Index", prefix + "{projectName}");
options.Conventions.AddPageRoute("/Documents/Project/Index", prefix + "{languageCode}/{projectName}");
options.Conventions.AddPageRoute("/Documents/Project/Index", prefix + "{languageCode}/{projectName}/{version}/{*documentName}");
});
Configure<AbpAutoMapperOptions>(options =>

Loading…
Cancel
Save