import { BlogPostTag, posts, type BlogPostLink } from '../../posts'; export async function load({ params }) { const post = await import(`../../${params.year}/${params.date}.md`); const tag: string = `${params.year}/${params.date}`; // link to the page. not to be confused with tags. i know it's confusing naming const postValues = posts.find((v: BlogPostLink) => v.key == tag)?.post; const content = post.default; const title: string = postValues?.title ?? ""; const subtitle: string = postValues?.subtitle ?? ""; const date: string = postValues?.date ?? ""; const dateUpdated: string = postValues?.dateUpdated ?? ""; const time: string = postValues?.time ?? ""; const banner: string = postValues?.banner ?? ""; const description: string = postValues?.description ?? ""; const tags: BlogPostTag[] = postValues?.tags ?? []; // blog post tags. should be renamed 'keywords' return { content, title, subtitle, banner, date, dateUpdated, time, tag, tags, description, }; }