perf!: pre-render post content

This commit is contained in:
Oliver Booth 2023-09-28 10:58:59 +01:00
parent de43cb5dbf
commit 6d572c7b6b
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
2 changed files with 2 additions and 9 deletions

View File

@ -88,8 +88,8 @@
</div> </div>
<hr> <hr>
<article data-blog-post="true" data-blog-id="@post.Id.ToString("D")"> <article>
<p class="text-center">Loading ...</p> @Html.Raw(BlogPostService.RenderPost(post))
</article> </article>
<hr> <hr>

View File

@ -53,13 +53,6 @@ declare const Prism: any;
API.getBlogPost(id).then((post) => { API.getBlogPost(id).then((post) => {
blogPost.innerHTML = post.content; blogPost.innerHTML = post.content;
UI.updateUI(blogPost); UI.updateUI(blogPost);
if (location.hash && location.hash !== '#' && location.hash.startsWith('#')) {
const element = document.querySelector(location.hash);
if (element) {
setTimeout(() => element.scrollIntoView(), 1000);
}
}
}); });
} }