This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async () => {
|
||||
const postFiles = import.meta.glob<{ metadata: { title: string; date: string; excerpt: string } }>(
|
||||
'./posts/*.md',
|
||||
{ eager: true }
|
||||
);
|
||||
const postFiles = import.meta.glob<{
|
||||
metadata: { title: string; date: string; excerpt: string; image?: string };
|
||||
}>('./posts/*.md', { eager: true });
|
||||
|
||||
const posts = Object.entries(postFiles).map(([path, post]) => {
|
||||
const slug = path.replace('./posts/', '').replace('.md', '');
|
||||
@@ -13,7 +12,8 @@ export const load: PageLoad = async () => {
|
||||
slug,
|
||||
title: post.metadata.title,
|
||||
date: post.metadata.date,
|
||||
excerpt: post.metadata.excerpt
|
||||
excerpt: post.metadata.excerpt,
|
||||
image: post.metadata.image
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user