💄 Add titles to the hosted pages
This commit is contained in:
@@ -15,29 +15,21 @@
|
||||
if (Model.UserAccount != null)
|
||||
{
|
||||
pageTitle = $"About {Model.UserAccount.Nick ?? Model.UserAccount.Name}";
|
||||
if (!string.IsNullOrWhiteSpace(Model.UserAccount.Profile?.Bio))
|
||||
{
|
||||
pageDescription = Model.UserAccount.Profile.Bio;
|
||||
}
|
||||
else
|
||||
{
|
||||
pageDescription = $"Profile of {Model.UserAccount.Nick ?? Model.UserAccount.Name} on {siteName}";
|
||||
}
|
||||
pageDescription = !string.IsNullOrWhiteSpace(Model.UserAccount.Profile?.Bio) ? Model.UserAccount.Profile.Bio : $"Profile of {Model.UserAccount.Nick ?? Model.UserAccount.Name} on {siteName}";
|
||||
|
||||
ogType = "profile";
|
||||
ogImageUrl = Model.UserPictureUrl;
|
||||
if(!string.IsNullOrEmpty(ogImageUrl) && !ogImageUrl.StartsWith("http"))
|
||||
{
|
||||
ogImageUrl = Model.UserBackgroundUrl;
|
||||
if (!string.IsNullOrEmpty(ogImageUrl) && !ogImageUrl.StartsWith("http"))
|
||||
ogImageUrl = $"{Request.Scheme}://{Request.Host}{ogImageUrl}";
|
||||
}
|
||||
}
|
||||
else if (Model.Site != null)
|
||||
{
|
||||
pageTitle = $"About {Model.Site.Name}";
|
||||
if(!string.IsNullOrWhiteSpace(Model.Site.Description))
|
||||
if (!string.IsNullOrWhiteSpace(Model.Site.Description))
|
||||
{
|
||||
pageDescription = Model.Site.Description;
|
||||
}
|
||||
|
||||
ogType = "website";
|
||||
ogImageUrl = null;
|
||||
}
|
||||
@@ -46,29 +38,31 @@
|
||||
{
|
||||
pageDescription = pageDescription.Substring(0, 157) + "...";
|
||||
}
|
||||
|
||||
ViewData["Title"] = $"{pageTitle} - {siteName}";
|
||||
}
|
||||
|
||||
@section Head {
|
||||
<title>@pageTitle - @siteName</title>
|
||||
<meta name="description" content="@pageDescription" />
|
||||
<link rel="canonical" href="@canonicalUrl" />
|
||||
|
||||
<meta property="og:title" content="@pageTitle" />
|
||||
<meta property="og:description" content="@pageDescription" />
|
||||
<meta property="og:type" content="@ogType" />
|
||||
<meta property="og:url" content="@canonicalUrl" />
|
||||
<meta name="description" content="@pageDescription"/>
|
||||
<link rel="canonical" href="@canonicalUrl"/>
|
||||
|
||||
<meta property="og:title" content="@pageTitle"/>
|
||||
<meta property="og:description" content="@pageDescription"/>
|
||||
<meta property="og:type" content="@ogType"/>
|
||||
<meta property="og:url" content="@canonicalUrl"/>
|
||||
@if (!string.IsNullOrEmpty(ogImageUrl))
|
||||
{
|
||||
<meta property="og:image" content="@ogImageUrl" />
|
||||
<meta property="og:image" content="@ogImageUrl"/>
|
||||
}
|
||||
<meta property="og:site_name" content="@siteName" />
|
||||
<meta property="og:site_name" content="@siteName"/>
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="twitter:title" content="@pageTitle" />
|
||||
<meta name="twitter:description" content="@pageDescription" />
|
||||
<meta name="twitter:card" content="summary"/>
|
||||
<meta name="twitter:title" content="@pageTitle"/>
|
||||
<meta name="twitter:description" content="@pageDescription"/>
|
||||
@if (!string.IsNullOrEmpty(ogImageUrl))
|
||||
{
|
||||
<meta name="twitter:image" content="@ogImageUrl" />
|
||||
<meta name="twitter:image" content="@ogImageUrl"/>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +353,7 @@
|
||||
<div class="flex flex-col p-5 opacity-80 text-sm">
|
||||
<p>Proudly powered by the Solar Network Pages</p>
|
||||
<p>Hosted on the Solar Network</p>
|
||||
<p class="mt-2">Networking with Cloudflare</p>
|
||||
<p class="mt-2">Network powered by Cloudflare</p>
|
||||
<p>Therefore, if the site is down, 99% is Cloudflare's fault</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,21 +8,20 @@
|
||||
var pageDescription = "A collection of posts.";
|
||||
string? ogImageUrl = null;
|
||||
var canonicalUrl = $"{Request.Scheme}://{Request.Host}{Request.Path}{Request.QueryString}";
|
||||
var siteName = Model.Publisher?.Nick ?? Model.Publisher?.Name ?? "Solar Network";
|
||||
var siteName = Model.Site?.Name ?? "Solar Network";
|
||||
|
||||
if (Model.Publisher != null)
|
||||
{
|
||||
pageTitle = $"Posts by {Model.Publisher.Nick ?? Model.Publisher.Name}";
|
||||
pageDescription = $"Browse posts written by {Model.Publisher.Nick ?? Model.Publisher.Name}.";
|
||||
pageTitle = $"Posts";
|
||||
pageDescription = $"Browse posts written by {Model.Publisher.Nick}.";
|
||||
if (Model.Publisher.Background != null)
|
||||
{
|
||||
ogImageUrl = $"{Request.Scheme}://{Request.Host}/drive/files/{Model.Publisher.Background.Id}";
|
||||
}
|
||||
}
|
||||
ViewData["Title"] = $"{pageTitle} - {siteName}";
|
||||
}
|
||||
|
||||
@section Head {
|
||||
<title>@pageTitle - @siteName</title>
|
||||
|
||||
<meta name="description" content="@pageDescription" />
|
||||
<link rel="canonical" href="@canonicalUrl" />
|
||||
|
||||
|
||||
@@ -24,10 +24,11 @@
|
||||
ogImageUrl = $"{Request.Scheme}://{Request.Host}/drive/files/{imageAttachment.Id}";
|
||||
}
|
||||
}
|
||||
ViewData["Title"] = pageTitle;
|
||||
}
|
||||
|
||||
@section Head {
|
||||
<title>@pageTitle</title>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(pageDescription))
|
||||
{
|
||||
<meta name="description" content="@pageDescription" />
|
||||
@@ -46,10 +47,10 @@
|
||||
|
||||
@if(post != null)
|
||||
{
|
||||
<meta property="article:published_time" content="@post.CreatedAt.ToString("o", System.Globalization.CultureInfo.InvariantCulture)" />
|
||||
<meta property="article:published_time" content="@post.CreatedAt.ToString()" />
|
||||
@if (post.EditedAt.HasValue)
|
||||
{
|
||||
<meta property="article:modified_time" content="@post.EditedAt.Value.ToString("o", System.Globalization.CultureInfo.InvariantCulture)" />
|
||||
<meta property="article:modified_time" content="@post.EditedAt.Value.ToString()" />
|
||||
}
|
||||
|
||||
@foreach (var tag in post.Tags)
|
||||
|
||||
Reference in New Issue
Block a user