diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts new file mode 100644 index 0000000..de4f6ab --- /dev/null +++ b/src/routes/+page.server.ts @@ -0,0 +1,7 @@ +import { fetchPostsSorted, sortPostsByPostAndUpdateDate } from "$src/lib/util/Blogs"; + +const LATEST_POSTS_COUNT = 3; + +export async function load() { + return { posts: (await fetchPostsSorted(sortPostsByPostAndUpdateDate)).slice(0, LATEST_POSTS_COUNT) }; +} \ No newline at end of file diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index e17465d..36571a1 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -2,6 +2,8 @@ import SocialButton from '$lib/components/SocialButton.svelte'; import SocialHyperlink from '$lib/components/SocialHyperlink.svelte'; import { PUBLIC_TS_DISCORD } from '$env/static/public'; + import BlogCard, { BlogCardSize } from '$src/lib/components/BlogCard.svelte'; + import { page } from '$app/state'; @@ -78,6 +80,19 @@ + +
+

ПОСЛЕДНИЕ ПОСТЫ

+ +
+ {#each page.data.posts as post, i} +
+ +
+ {/each} +
+
+