Added meta and open graph headers to user pages
Some checks failed
Docker Release / build (push) Has been cancelled
GitHub Release / Generate Release (push) Has been cancelled

This commit is contained in:
Mia Rose Winter 2024-03-27 11:23:02 +01:00
parent e38b32467b
commit 1932520b6a
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
3 changed files with 28 additions and 3 deletions

View file

@ -4,6 +4,7 @@
@using Microsoft.Extensions.Options @using Microsoft.Extensions.Options
@using Wave.Utilities @using Wave.Utilities
@inject NavigationManager Navigation
@inject IDbContextFactory<ApplicationDbContext> ContextFactory @inject IDbContextFactory<ApplicationDbContext> ContextFactory
@inject IOptions<Customization> Customizations @inject IOptions<Customization> Customizations
@inject IOptions<Features> Features @inject IOptions<Features> Features
@ -11,10 +12,22 @@
@inject IMessageDisplay Message @inject IMessageDisplay Message
<HeadContent> <HeadContent>
@if (Features.Value.Rss && User is not null) { @if (User is not null) {
<meta name="author" content="@User.Name">
<meta name="description" content="@string.Format(Localizer["Meta_Description"], User.Name, Customizations.Value.AppName)">
<!-- Open Graph -->
<meta property="og:title" content="@string.Format(Localizer["Meta_OpenGraph_Title"], User.Name, Customizations.Value.AppName)">
<meta property="og:description" content="@string.Format(Localizer["Meta_Description"], User.Name, Customizations.Value.AppName)">
<meta property="og:type" content="profile">
<meta property="og:image" content="@Navigation.ToAbsoluteUri("/api/user/pfp/" + User.Id)">
<meta property="og:site_name" content="@Customizations.Value.AppName">
@if (Features.Value.Rss) {
<link rel="alternate" type="application/rss+xml" title="RSS Feed on @Customizations.Value.AppName | User @User.FullName" href="/rss/rss.xml?author=@User.Id"> <link rel="alternate" type="application/rss+xml" title="RSS Feed on @Customizations.Value.AppName | User @User.FullName" href="/rss/rss.xml?author=@User.Id">
<link rel="alternate" type="application/atom+xml" title="Atom RSS Feed on @Customizations.Value.AppName | User @User.FullName" href="/rss/atom.xml?author=@User.Id"> <link rel="alternate" type="application/atom+xml" title="Atom RSS Feed on @Customizations.Value.AppName | User @User.FullName" href="/rss/atom.xml?author=@User.Id">
} }
}
@if (User is null) { @if (User is null) {
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
} }

View file

@ -119,4 +119,10 @@
<data name="ProfileNotPublic_Message" xml:space="preserve"> <data name="ProfileNotPublic_Message" xml:space="preserve">
<value>Ihr Profil ist momentan nicht öffentlich einsehbar. </value> <value>Ihr Profil ist momentan nicht öffentlich einsehbar. </value>
</data> </data>
<data name="Meta_Description" xml:space="preserve">
<value>Authorenprofil von {0} auf {1}</value>
</data>
<data name="Meta_OpenGraph_Title" xml:space="preserve">
<value>{0} auf {1}</value>
</data>
</root> </root>

View file

@ -119,4 +119,10 @@
<data name="ProfileNotPublic_Message" xml:space="preserve"> <data name="ProfileNotPublic_Message" xml:space="preserve">
<value>Your profile is currently not publicly visible.</value> <value>Your profile is currently not publicly visible.</value>
</data> </data>
<data name="Meta_Description" xml:space="preserve">
<value>Author Profile of {0} on {1}</value>
</data>
<data name="Meta_OpenGraph_Title" xml:space="preserve">
<value>{0} on {1}</value>
</data>
</root> </root>