import { error } from "@sveltejs/kit";

/** @type {import("./$types").PageServerLoad} */
export async function load({ params }) {
    try {
        const page = await import(`../../data/pages/${params.slug}.md`);
        return { ...page.metadata, content: page.default };
    } catch (e) {
        console.error(e);
        error(404, "Not found");
    }
}
