From b584bb84a20489a08b4fe77b76ea97e4acf2c93c Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Tue, 8 Aug 2023 01:34:27 +0100
Subject: [PATCH] style: guard clause article page
---
OliverBooth/Pages/Blog/Article.cshtml | 124 +++++++++++++-------------
1 file changed, 64 insertions(+), 60 deletions(-)
diff --git a/OliverBooth/Pages/Blog/Article.cshtml b/OliverBooth/Pages/Blog/Article.cshtml
index 3454f21..7e3435a 100644
--- a/OliverBooth/Pages/Blog/Article.cshtml
+++ b/OliverBooth/Pages/Blog/Article.cshtml
@@ -2,73 +2,77 @@
@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}/";
+}
-
-
- @post.Title
-
-
- @Model.Author?.Name
- •
-
- @post.Published.Humanize()
-
- @if (post.EnableComments)
- {
- •
- 0 Comments
- }
-
-
-
- @Html.Raw(Model.SanitizeContent(post.Body))
-
-
-
+
+@post.Title
+
+
+ @Model.Author?.Name
+ •
+
+ @post.Published.Humanize()
+
@if (post.EnableComments)
{
-
-
-
-
+ •
+ 0 Comments
}
- else
- {
- Comments are not enabled for this post.
- }
-}
\ No newline at end of file
+
+
+
+ @Html.Raw(Model.SanitizeContent(post.Body))
+
+
+
+
+@if (post.EnableComments)
+{
+
+
+
+
+}
+else
+{
+ Comments are not enabled for this post.
+}