Блоги #1

Merged
rndtrash merged 64 commits from feature-blogs into master 2025-10-22 08:44:56 +03:00
4 changed files with 18 additions and 8 deletions
Showing only changes of commit 2d010fdcce - Show all commits

8
src/app.d.ts vendored
View file

@ -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[];
}
}
}

View file

@ -0,0 +1,9 @@
---
title: 'Тестовый блог'
date:
description: 'Немного о самом сайте'
---
# ПРИВЕТ !
Добро пожаловать на наш первый блог-пост!

View file

@ -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;

View file

@ -26,7 +26,7 @@ ${posts.map((post) => `<item>
<description>${escapeXml(post.description)}</description>
<guid isPermaLink="true">https://teasanctuary.ru/blog/${post.slug}</guid>
<link>https://teasanctuary.ru/blog/${post.slug}</link>
<pubDate>${(new Date(post.date)).toUTCString()}</pubDate>
<pubDate>${(new Date(post.date!)).toUTCString()}</pubDate>
</item>`).join("\n")}
</channel>
</rss>`))