Files
pages/src/routes/blog/[year]/[date]/+page.ts
2026-01-29 16:42:08 +01:00

24 lines
669 B
TypeScript

import { posts, type BlogPostDetails } from '../../posts';
export async function load({ params }) {
const post = await import(`../../${params.year}/${params.date}.md`);
const tag: string = `${params.year}/${params.date}`;
const postValues = posts.get(tag);
const content = post.default;
const title: string = postValues?.title ?? "";
const date: string = postValues?.date ?? "";
const time: string = postValues?.time ?? "";
const banner: string = (postValues?.banner === "" ? "preview.webp" : postValues?.banner)!;
const description: string = postValues?.description ?? "";
return {
content,
title,
banner,
date,
time,
tag,
description,
};
}