diff --git a/src/App.svelte b/src/App.svelte index 68a4440..d27044b 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -24,6 +24,9 @@ let searchValue = ''; + /** + * @param {{ detail: string; }} event + */ function handleSearch(event) { searchValue = event.detail; } diff --git a/src/routes/Post.svelte b/src/routes/Post.svelte index 7d7a3e2..2ba93cd 100644 --- a/src/routes/Post.svelte +++ b/src/routes/Post.svelte @@ -5,10 +5,21 @@ import NotFound from "./NotFound.svelte"; import navigate from 'svelte-spa-router'; - export let params: {year?: string, month?: string, day?: string, title?: string} = {}; + export let params: {year: string, month: string, day: string, title: string} = { + year: "", + month: "", + day: "", + title: "" + }; let posts: { id: any; }[] = []; - let post: {id: String, date: String, title: String, author: String, description: String} = {}; + let post: {id: string, date: string, title: string, author: string, description: string} = { + id: '', + date: '', + title: '', + author: '', + description: '' + }; let postTitle = ""; let postAuthor = ""; @@ -53,7 +64,10 @@ if (await content.ok) { let markdowncontent = await content.text(); markdowncontent = await marked.parse(removePostVars(markdowncontent)); - document.getElementById('markdowncontent').innerHTML = await markdowncontent; + const markdowncontentElement = document.getElementById('markdowncontent'); + if (markdowncontentElement) { + markdowncontentElement.innerHTML = await markdowncontent; + } loading = false; postTitle = post.title; postAuthor = post.author; @@ -129,6 +143,8 @@ function copyLink() {

by

{postAuthor}

{postDate}

+ +