get poetry stuff workin

This commit is contained in:
2024-05-29 18:33:13 -04:00
parent 3d22344e7f
commit 251620863c
42 changed files with 632 additions and 299 deletions

View File

@@ -0,0 +1,19 @@
<script context="module">
import { onMount } from 'svelte';
import Headline from './poetry/h1.svelte';
import p from './poetry/p.svelte';
export { Headline as h1, p };
</script>
<script lang="ts">
export let title;
export let date;
export let categories;
export let tags;
export let year;
export let layout;
</script>
<main>
<slot />
</main>

View File

@@ -41,7 +41,7 @@ export const fetchMarkdownPosts = async (
section: SectionKey,
limit: number,
offset: number
): Promise<Post[]> => {
): Promise<{posts: Post[], total: number}> => {
let posts: Record<string, () => Promise<unknown>>;
switch (section) {
case 'poetry':
@@ -74,7 +74,9 @@ export const fetchMarkdownPosts = async (
})
);
const paginatedPosts = allPosts.slice(offset, offset + limit);
const sortedPosts = allPosts.sort((a, b) => new Date(a.meta.date).getTime() - new Date(b.meta.date).getTime() );
return paginatedPosts;
const paginatedPosts = sortedPosts.slice(offset, offset + limit);
return {posts: paginatedPosts, total: allPosts.length};
};

View File

@@ -0,0 +1,3 @@
<h1 class="poetry-headline">
<slot></slot>
</h1>

View File

@@ -0,0 +1,3 @@
<p class="whitespace-pre">
<slot></slot>
</p>