style: guard clause article page
This commit is contained in:
parent
83e5757429
commit
b584bb84a2
@ -2,12 +2,17 @@
|
||||
@using Humanizer
|
||||
@model OliverBooth.Pages.Blog.Article
|
||||
|
||||
@if (Model.Post is { } post)
|
||||
@if (Model.Post is not { } post)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@{
|
||||
bool isLegacyPost = Model.IsWordPressLegacyPost;
|
||||
string disqusDomain = isLegacyPost ? "https://blog.oliverbooth.dev" : "https://oliverbooth.dev/blog";
|
||||
string disqusId = isLegacyPost ? $"{post.WordPressId} {disqusDomain}/?p={post.WordPressId}" : post.Id.ToString();
|
||||
var disqusUrl = $"{disqusDomain}/{post.Published:yyyy/MM/dd}/{post.Slug}/";
|
||||
}
|
||||
|
||||
<nav style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
@ -44,9 +49,9 @@
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
var disqus_config = function () {
|
||||
this.page.url = "@(disqusUrl)";
|
||||
this.page.identifier = "@(disqusId)";
|
||||
this.page.title = "@(post.Title)";
|
||||
this.page.url = "@disqusUrl";
|
||||
this.page.identifier = "@disqusId";
|
||||
this.page.title = "@post.Title";
|
||||
this.page.postId = "@(post.WordPressId ?? post.Id)";
|
||||
};
|
||||
|
||||
@ -71,4 +76,3 @@
|
||||
{
|
||||
<p class="text-center text-muted">Comments are not enabled for this post.</p>
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user