From 6d572c7b6ba766b7d4e087c98b1c79a7e7eaeceb Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Thu, 28 Sep 2023 10:58:59 +0100 Subject: [PATCH] perf!: pre-render post content --- OliverBooth/Pages/Blog/Article.cshtml | 4 ++-- src/ts/app.ts | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/OliverBooth/Pages/Blog/Article.cshtml b/OliverBooth/Pages/Blog/Article.cshtml index dbed135..887d184 100644 --- a/OliverBooth/Pages/Blog/Article.cshtml +++ b/OliverBooth/Pages/Blog/Article.cshtml @@ -88,8 +88,8 @@
-
-

Loading ...

+
+ @Html.Raw(BlogPostService.RenderPost(post))

diff --git a/src/ts/app.ts b/src/ts/app.ts index 968fa29..3daa3f2 100644 --- a/src/ts/app.ts +++ b/src/ts/app.ts @@ -53,13 +53,6 @@ declare const Prism: any; API.getBlogPost(id).then((post) => { blogPost.innerHTML = post.content; UI.updateUI(blogPost); - - if (location.hash && location.hash !== '#' && location.hash.startsWith('#')) { - const element = document.querySelector(location.hash); - if (element) { - setTimeout(() => element.scrollIntoView(), 1000); - } - } }); }