Added meta, opengraph to ArticleView
This commit is contained in:
parent
6beb81675d
commit
e2c935467f
|
@ -3,12 +3,34 @@
|
||||||
@using Wave.Data
|
@using Wave.Data
|
||||||
@using System.Security.Claims
|
@using System.Security.Claims
|
||||||
@using System.Diagnostics.CodeAnalysis
|
@using System.Diagnostics.CodeAnalysis
|
||||||
|
@using Microsoft.Extensions.Options
|
||||||
|
|
||||||
@inject IDbContextFactory<ApplicationDbContext> ContextFactory;
|
@inject IDbContextFactory<ApplicationDbContext> ContextFactory;
|
||||||
@inject NavigationManager Navigation
|
@inject NavigationManager Navigation
|
||||||
|
@inject IOptions<Customization> Customizations
|
||||||
@inject IStringLocalizer<ArticleView> Localizer
|
@inject IStringLocalizer<ArticleView> Localizer
|
||||||
|
|
||||||
<PageTitle>@(TitlePrefix + (Article?.Title ?? @Localizer["NotFound_Title"]))</PageTitle>
|
<PageTitle>@(TitlePrefix + (Article?.Title ?? Localizer["NotFound_Title"]))</PageTitle>
|
||||||
|
|
||||||
|
@if (Article is not null) {
|
||||||
|
<HeadContent>
|
||||||
|
<meta name="author" content="@Article.Author.Name">
|
||||||
|
<meta name="description" content="@string.Format(Localizer["Meta_Description"], Customizations.Value.AppName, Article.Body[..Math.Min(80, Article.Body.Length)] + "... ")">
|
||||||
|
|
||||||
|
<!-- Open Graph -->
|
||||||
|
<meta property="og:title" content="@Article.Title" />
|
||||||
|
<meta property="og:description" content="@string.Format(Localizer["Meta_Description"], Customizations.Value.AppName, Article.Body[..Math.Min(80, Article.Body.Length)] + "... ")" />
|
||||||
|
<meta property="og:url" content="@Navigation.ToAbsoluteUri("/article/" + Article.Id)" />
|
||||||
|
<meta property="og:image" content="@Navigation.ToAbsoluteUri("/api/user/pfp/" + Article.Author.Id)" />
|
||||||
|
<meta property="og:type" content="article" />
|
||||||
|
<meta property="og:article:author" content="@Article.Author.Name" />
|
||||||
|
<meta property="og:article:published_time" content="@Article.PublishDate.ToString("u")" />
|
||||||
|
@if (Article.LastModified.HasValue) {
|
||||||
|
<meta property="og:article:modified_time " content="@Article.LastModified.Value.ToString("u")" />
|
||||||
|
}
|
||||||
|
<meta property="og:site_name" content="@Customizations.Value.AppName" />
|
||||||
|
</HeadContent>
|
||||||
|
}
|
||||||
|
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<ChildContent>
|
<ChildContent>
|
||||||
|
|
|
@ -125,4 +125,7 @@
|
||||||
<data name="Publish_Submit" xml:space="preserve">
|
<data name="Publish_Submit" xml:space="preserve">
|
||||||
<value>Zur Veröffentlichung freigeben</value>
|
<value>Zur Veröffentlichung freigeben</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Meta_Description" xml:space="preserve">
|
||||||
|
<value>{1} Weiterlesen auf {0}.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -125,4 +125,7 @@
|
||||||
<data name="Publish_Submit" xml:space="preserve">
|
<data name="Publish_Submit" xml:space="preserve">
|
||||||
<value>Approv for Publishing</value>
|
<value>Approv for Publishing</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Meta_Description" xml:space="preserve">
|
||||||
|
<value>{1} Continue reading on {0}. </value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in a new issue