diff --git a/src/app.d.ts b/src/app.d.ts index 1243e75..f9281b5 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -1,5 +1,3 @@ -import type { Member } from '$lib/types/Member'; - declare global { namespace App { // interface Error {} @@ -23,12 +21,12 @@ declare global { interface BlogPost { slug: string; title: string; - thumbnail: string; - date: string; + thumbnail?: string; + date?: string; description: string; publisher: string; published?: boolean; - member?: Member; + projects?: string[]; } } } diff --git a/src/blogs/test_unpublished.md b/src/blogs/test_unpublished.md new file mode 100644 index 0000000..c932b19 --- /dev/null +++ b/src/blogs/test_unpublished.md @@ -0,0 +1,9 @@ +--- +title: 'Тестовый блог' +date: +description: 'Немного о самом сайте' +--- + +# ПРИВЕТ ! + +Добро пожаловать на наш первый блог-пост! \ No newline at end of file diff --git a/src/lib/util/Blogs.ts b/src/lib/util/Blogs.ts index 851992e..2e00ced 100644 --- a/src/lib/util/Blogs.ts +++ b/src/lib/util/Blogs.ts @@ -3,8 +3,11 @@ import path from 'path'; export async function fetchPostsSorted() { const allPosts = await fetchPosts(); - const sortedPosts = allPosts.sort((a, b) => { - return new Date(b.date).valueOf() - new Date(a.date).valueOf(); + const sortedPosts = allPosts + // Для списка постов оставляем только те, у которых объявлена дата публикации + .filter((a) => !!a.date) + .sort((a, b) => { + return new Date(b.date!).valueOf() - new Date(a.date!).valueOf(); }); return sortedPosts; diff --git a/src/routes/blog/rss.xml/+server.ts b/src/routes/blog/rss.xml/+server.ts index 0ed51da..4cb1e2f 100644 --- a/src/routes/blog/rss.xml/+server.ts +++ b/src/routes/blog/rss.xml/+server.ts @@ -26,7 +26,7 @@ ${posts.map((post) => ` ${escapeXml(post.description)} https://teasanctuary.ru/blog/${post.slug} https://teasanctuary.ru/blog/${post.slug} -${(new Date(post.date)).toUTCString()} +${(new Date(post.date!)).toUTCString()} `).join("\n")} `))