Added OpenGraph to Home, addded Customization for page description

This commit is contained in:
Mia Rose Winter 2024-02-07 13:52:18 +01:00
parent 452c93fca0
commit b66c26394d
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
2 changed files with 98 additions and 78 deletions

View file

@ -1,14 +1,33 @@
@page "/" @page "/"
@using Microsoft.Extensions.Localization @using Microsoft.Extensions.Localization
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@using Microsoft.Extensions.Options
@using Wave.Data @using Wave.Data
@using Wave.Utilities @using Wave.Utilities
@rendermode InteractiveServer @rendermode InteractiveServer
@attribute [StreamRendering] @attribute [StreamRendering]
@inject IOptions<Customization> Customizations
@inject NavigationManager Navigation
@inject IDbContextFactory<ApplicationDbContext> ContextFactory; @inject IDbContextFactory<ApplicationDbContext> ContextFactory;
@inject IStringLocalizer<Home> Localizer @inject IStringLocalizer<Home> Localizer
<HeadContent>
<meta property="og:type" content="website">
<meta property="og:title" content="@Customizations.Value.AppName">
<meta property="og:site_name" content="@Customizations.Value.AppName">
<meta property="og:url" content="@Navigation.BaseUri">
@if (!string.IsNullOrWhiteSpace(Customizations.Value.LogoLink)) {
<meta property="og:image" content="@Customizations.Value.LogoLink">
} else {
<meta property="og:image" content="@Navigation.ToAbsoluteUri("/img/logo.png")">
}
@if (!string.IsNullOrWhiteSpace(Customizations.Value.AppDescription)) {
<meta property="description" content="@Customizations.Value.AppDescription">
<meta property="og:description" content="@Customizations.Value.AppDescription">
}
</HeadContent>
<PageTitle>@(TitlePrefix + Localizer["Title"])</PageTitle> <PageTitle>@(TitlePrefix + Localizer["Title"])</PageTitle>
<h1 class="text-3xl lg:text-5xl font-light mb-6 text-primary">@Localizer["Title"]</h1> <h1 class="text-3xl lg:text-5xl font-light mb-6 text-primary">@Localizer["Title"]</h1>

View file

@ -2,6 +2,7 @@
public class Customization { public class Customization {
public string AppName { get; set; } = "Wave"; public string AppName { get; set; } = "Wave";
public string AppDescription { get; set; } = "";
public string DefaultTheme { get; set; } = ""; public string DefaultTheme { get; set; } = "";
public string LogoLink { get; set; } = ""; public string LogoLink { get; set; } = "";
public string Footer { get; set; } = ""; public string Footer { get; set; } = "";