import type { PageServerLoad } from './$types';
import { getAllPosts, getAllTags } from '$lib/blog/posts';

export const load: PageServerLoad = () => {
	const posts = getAllPosts().map(({ slug, title, author, date, tags, excerpt, readingTime }) => ({
		slug,
		title,
		author,
		date,
		tags,
		excerpt,
		readingTime
	}));

	return {
		posts,
		tags: getAllTags()
	};
};
