💄 Add titles to the hosted pages

This commit is contained in:
2025-11-22 13:49:26 +08:00
parent 9d2242d331
commit f4505d2ecc
3 changed files with 31 additions and 37 deletions

View File

@@ -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" />