Files
pages/src/routes/blog/[year]/[date]/+page.ts

24 lines
669 B
TypeScript
Raw Normal View History

2026-01-05 12:35:16 +00:00
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;
2026-01-29 16:42:08 +01:00
const title: string = postValues?.title ?? "";
2026-01-05 12:35:16 +00:00
const date: string = postValues?.date ?? "";
2026-01-29 16:42:08 +01:00
const time: string = postValues?.time ?? "";
const banner: string = (postValues?.banner === "" ? "preview.webp" : postValues?.banner)!;
2026-01-05 12:35:16 +00:00
const description: string = postValues?.description ?? "";
return {
content,
title,
2026-01-29 16:42:08 +01:00
banner,
2026-01-05 12:35:16 +00:00
date,
2026-01-29 16:42:08 +01:00
time,
2026-01-05 12:35:16 +00:00
tag,
description,
};
}