>().Value;
+ if (options.CheckLibs)
+ {
+ var app = context.GetApplicationBuilder();
+ app.Use(async (httpContext, next) =>
+ {
+ if (!await CheckLibsAsyncOnceAsync(httpContext))
+ {
+ httpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
+ httpContext.Response.ContentType = "text/html";
+ await httpContext.Response.WriteAsync(
+ "" +
+ " " +
+ " Error - The Libs folder is missing!" +
+ " " +
+ " " +
+ " ⚠️ The Libs folder under the wwwroot/libs directory is empty!
" +
+ " The Libs folder contains mandatory NPM Packages for running the project.
" +
+ " Make sure you run the abp install-libs CLI tool command.
" +
+ " For more information, check out the ABP CLI documentation
" +
+ " " +
+ "",
+ Encoding.UTF8
+ );
+ return;
+ }
+
+ await next(httpContext);
+ });
+ }
+ }
+
+ protected virtual Task CheckLibsAsyncOnceAsync(HttpContext httpContext)
+ {
+ if (_checkLibsTask == null)
+ {
+ _checkLibsTask = CheckLibsAsync(httpContext);
+ }
+
+ return _checkLibsTask;
+ }
+
+ protected virtual Task CheckLibsAsync(HttpContext httpContext)
+ {
+ var logger = httpContext.RequestServices.GetRequiredService>();
+ try
+ {
+ var fileProvider = new PhysicalFileProvider(httpContext.RequestServices.GetRequiredService().WebRootPath);
+ var libsFolder = fileProvider.GetDirectoryContents("/libs");
+ if (!libsFolder.Exists || !libsFolder.Any())
+ {
+ logger.LogError("The 'wwwroot/libs' folder does not exist or empty!");
+ return Task.FromResult(false);
+ }
+ }
+ catch (Exception e)
+ {
+ // In case of any exception, log it and return true to prevent crashing the application.
+ logger.LogError(e, "An error occurred while checking the libs folder!");
+ }
+
+ return Task.FromResult(true);
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/IAbpMvcLibsService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/IAbpMvcLibsService.cs
new file mode 100644
index 0000000000..98a88184e8
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/IAbpMvcLibsService.cs
@@ -0,0 +1,6 @@
+namespace Volo.Abp.AspNetCore.Mvc.Libs;
+
+public interface IAbpMvcLibsService
+{
+ void CheckLibs(ApplicationInitializationContext context);
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
index 027403d226..0e13746d66 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
using Volo.Abp.AspNetCore.Mvc.GlobalFeatures;
+using Volo.Abp.AspNetCore.Mvc.Libs;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.Localization.Resource;
using Volo.Abp.AspNetCore.Security.Claims;
@@ -140,6 +141,11 @@ public class AbpAspNetCoreMvcTestModule : AbpModule
});
context.Services.TransformAbpClaims();
+
+ Configure(options =>
+ {
+ options.CheckLibs = false;
+ });
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
diff --git a/latest-versions.json b/latest-versions.json
index 4649df25e4..8e0b7be03d 100644
--- a/latest-versions.json
+++ b/latest-versions.json
@@ -1,6 +1,6 @@
[
{
- "version": "8.2.1",
+ "version": "8.2.2",
"releaseDate": "",
"type": "stable",
"message": ""
diff --git a/modules/docs/src/Volo.Docs.Web/Bundling/PrismjsScriptBundleContributorDocsExtension.cs b/modules/docs/src/Volo.Docs.Web/Bundling/PrismjsScriptBundleContributorDocsExtension.cs
index 3fc129bf55..0be1e7cb29 100644
--- a/modules/docs/src/Volo.Docs.Web/Bundling/PrismjsScriptBundleContributorDocsExtension.cs
+++ b/modules/docs/src/Volo.Docs.Web/Bundling/PrismjsScriptBundleContributorDocsExtension.cs
@@ -23,7 +23,8 @@ namespace Volo.Docs.Bundling
"scss",
"sql",
"typescript",
- "diff"
+ "diff",
+ "yaml"
};
public override void ConfigureBundle(BundleConfigurationContext context)
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 d69d72f038..2f029fcfce 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
@@ -197,7 +197,6 @@ namespace Volo.Docs.Pages.Documents.Project
await SetNavigationAsync();
SetLanguageSelectListItems();
- SetDocumentPageTitle();
return Page();
}
@@ -472,7 +471,12 @@ namespace Volo.Docs.Pages.Documents.Project
private void SetDocumentPageTitle()
{
- DocumentPageTitle = Navigation.FindNavigation(DocumentNameWithExtension)?.Text ?? DocumentName?.Replace("-", " ");
+ DocumentPageTitle = DocumentName?.Replace("-", " ");
+ var match = Regex.Match(Document.Content, @"#(?.+)");
+ if (match.Success && match.Groups.TryGetValue("PageTitle", out var group))
+ {
+ DocumentPageTitle = Regex.Replace(group.Value, "<.*?>", string.Empty).Trim();
+ }
}
public string CreateVersionLink(VersionInfoViewModel latestVersion, string version, string documentName = null)
@@ -508,6 +512,7 @@ namespace Volo.Docs.Pages.Documents.Project
Document = await GetSpecificDocumentOrDefaultAsync(language);
DocumentLanguageCode = language;
DocumentNameWithExtension = Document.Name;
+ SetDocumentPageTitle();
await ConvertDocumentContentToHtmlAsync();
return true;
}