🐛 Serval bug fixes in hosted page
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
@model DysonNetwork.Zone.Pages.Posts.DetailsModel
|
||||
@{
|
||||
Layout = "_LayoutContained";
|
||||
|
||||
|
||||
var post = Model.Post;
|
||||
var pageTitle = post?.Title ?? "Post";
|
||||
var pageDescription = post?.Description;
|
||||
var pageDescription = post?.Description;
|
||||
string? ogImageUrl = null;
|
||||
var canonicalUrl = $"{Request.Scheme}://{Request.Host}{Request.Path}{Request.QueryString}";
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
ogImageUrl = $"{Request.Scheme}://{Request.Host}/drive/files/{imageAttachment.Id}";
|
||||
}
|
||||
}
|
||||
|
||||
ViewData["Title"] = pageTitle;
|
||||
}
|
||||
|
||||
@@ -31,43 +32,39 @@
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(pageDescription))
|
||||
{
|
||||
<meta name="description" content="@pageDescription" />
|
||||
<meta property="og:description" content="@pageDescription" />
|
||||
<meta name="twitter:description" content="@pageDescription" />
|
||||
<meta name="description" content="@pageDescription"/>
|
||||
<meta property="og:description" content="@pageDescription"/>
|
||||
<meta name="twitter:description" content="@pageDescription"/>
|
||||
}
|
||||
<link rel="canonical" href="@canonicalUrl" />
|
||||
<link rel="canonical" href="@canonicalUrl"/>
|
||||
|
||||
<meta property="og:title" content="@pageTitle" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="@canonicalUrl" />
|
||||
<meta property="og:title" content="@pageTitle"/>
|
||||
<meta property="og:type" content="article"/>
|
||||
<meta property="og:url" content="@canonicalUrl"/>
|
||||
@if (!string.IsNullOrEmpty(ogImageUrl))
|
||||
{
|
||||
<meta property="og:image" content="@ogImageUrl" />
|
||||
<meta property="og:image" content="@ogImageUrl"/>
|
||||
}
|
||||
|
||||
@if(post != null)
|
||||
|
||||
@if (post != null)
|
||||
{
|
||||
<meta property="article:published_time" content="@post.CreatedAt.ToString()" />
|
||||
<meta property="article:published_time" content="@post.CreatedAt.ToString()"/>
|
||||
@if (post.EditedAt.HasValue)
|
||||
{
|
||||
<meta property="article:modified_time" content="@post.EditedAt.Value.ToString()" />
|
||||
<meta property="article:modified_time" content="@post.EditedAt.Value.ToString()"/>
|
||||
}
|
||||
|
||||
@foreach (var tag in post.Tags)
|
||||
@foreach (var tagName in post.Tags.Select(tag => !string.IsNullOrEmpty(tag.Name) ? tag.Name : tag.Slug).Where(tagName => !string.IsNullOrEmpty(tagName)))
|
||||
{
|
||||
var tagName = !string.IsNullOrEmpty(tag.Name) ? tag.Name : tag.Slug;
|
||||
if(!string.IsNullOrEmpty(tagName))
|
||||
{
|
||||
<meta property="article:tag" content="@tagName" />
|
||||
}
|
||||
<meta property="article:tag" content="@tagName"/>
|
||||
}
|
||||
}
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="@pageTitle" />
|
||||
<meta name="twitter:card" content="summary_large_image"/>
|
||||
<meta name="twitter:title" content="@pageTitle"/>
|
||||
@if (!string.IsNullOrEmpty(ogImageUrl))
|
||||
{
|
||||
<meta name="twitter:image" content="@ogImageUrl" />
|
||||
<meta name="twitter:image" content="@ogImageUrl"/>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +81,7 @@
|
||||
{
|
||||
<p>@Model.Post.Description</p>
|
||||
}
|
||||
|
||||
|
||||
<div class="mt-2 flex gap-3 flex-wrap text-sm text-base-content/60">
|
||||
<div class="flex gap-1">
|
||||
<span class="mdi mdi-history"></span>
|
||||
@@ -92,7 +89,7 @@
|
||||
Posted on @Model.Post.CreatedAt.ToDateTimeOffset().ToString("yyyy-MM-dd HH:mm")
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@if (Model.Post.EditedAt.HasValue)
|
||||
{
|
||||
<div class="flex gap-1">
|
||||
@@ -109,10 +106,6 @@
|
||||
<div class="card bg-base-200 shadow-md">
|
||||
<div class="card-body flex flex-col gap-5">
|
||||
<div class="prose max-w-none">
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Post.Description))
|
||||
{
|
||||
<p>@Model.Post.Description</p>
|
||||
}
|
||||
@Html.Raw(Model.Post.Content)
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user