add images to posts
Some checks failed
Deploy Blog / deploy (push) Has been cancelled

This commit is contained in:
2025-12-28 22:53:52 +02:00
parent 67e207c4f9
commit 095e18e036
6 changed files with 56 additions and 14 deletions

View File

@@ -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
};
});