23 lines
526 B
TypeScript
23 lines
526 B
TypeScript
import { error, redirect } from '@sveltejs/kit';
|
|
import { staticPages, type StaticPageSlug } from '$lib/content/static-pages';
|
|
import { getSharedPageContent } from '$lib/server/content';
|
|
|
|
export async function load({ params }) {
|
|
if (params.slug === 'about-us') {
|
|
throw redirect(301, '/about');
|
|
}
|
|
|
|
const slug = params.slug as StaticPageSlug;
|
|
const page = staticPages[slug];
|
|
|
|
if (!page) {
|
|
throw error(404, 'Page not found');
|
|
}
|
|
|
|
return {
|
|
content: await getSharedPageContent(),
|
|
page,
|
|
slug
|
|
};
|
|
}
|