From 8c2dccde3e91c499e07b1ea3d86a3c810e1ba7fc Mon Sep 17 00:00:00 2001 From: the1mason Date: Fri, 27 Sep 2024 02:59:25 +0500 Subject: [PATCH] removed hardcoded texts --- src/FastBlog.Web/DisplayOptions.cs | 8 ++++++++ src/FastBlog.Web/Program.cs | 2 ++ src/FastBlog.Web/Views/Shared/_Layout.cshtml | 16 ++++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 src/FastBlog.Web/DisplayOptions.cs diff --git a/src/FastBlog.Web/DisplayOptions.cs b/src/FastBlog.Web/DisplayOptions.cs new file mode 100644 index 0000000..9d42c31 --- /dev/null +++ b/src/FastBlog.Web/DisplayOptions.cs @@ -0,0 +1,8 @@ +namespace FastBlog.Web; + +public class DisplayOptions +{ + public string Title { get; init; } = "FastBlog"; + + public Dictionary Links { get; init; } = []; +} \ No newline at end of file diff --git a/src/FastBlog.Web/Program.cs b/src/FastBlog.Web/Program.cs index ca27467..8f9fddd 100644 --- a/src/FastBlog.Web/Program.cs +++ b/src/FastBlog.Web/Program.cs @@ -1,4 +1,5 @@ using FastBlog.Core; +using FastBlog.Web; var builder = WebApplication.CreateBuilder(args); @@ -9,6 +10,7 @@ else builder.Services.AddControllersWithViews(); builder.Services.AddCore(builder.Configuration); +builder.Services.Configure(builder.Configuration.GetSection("Display")); var app = builder.Build(); diff --git a/src/FastBlog.Web/Views/Shared/_Layout.cshtml b/src/FastBlog.Web/Views/Shared/_Layout.cshtml index f3cbd2a..bd5deeb 100644 --- a/src/FastBlog.Web/Views/Shared/_Layout.cshtml +++ b/src/FastBlog.Web/Views/Shared/_Layout.cshtml @@ -1,4 +1,7 @@ -@{ +@using Microsoft.Extensions.Options +@inject IOptions options; + +@{ ViewContext.HttpContext.Response.Headers.Add("Vary", "Hx-Request"); } @@ -13,7 +16,7 @@ return; - @ViewData["Title"] | FastBlog.Web + @ViewData["Title"] | @options.Value.Title @@ -26,13 +29,14 @@ return;