remove strapi and use mdsvex for blog
Some checks failed
Deployment / Deploy website (push) Successful in 3m21s
Deployment / Deploy strapi (push) Failing after 1m12s

This commit is contained in:
Benjamin Palko 2026-01-22 23:53:41 -05:00
parent 4673e8dbe6
commit 32fd2642b1
14 changed files with 319 additions and 180 deletions

35
src/lib/posts/index.ts Normal file
View file

@ -0,0 +1,35 @@
export type Categories = 'development' | 'work' | 'life';
export type Post = {
title: string
slug: string
description: string
image: {
url: string;
alt: string;
}
date: string
categories: Categories[]
published: boolean
}
export async function getPosts() {
const posts: Post[] = []
const paths = import.meta.glob('/src/lib/posts/*.md', { eager: true })
for (const path in paths) {
const file = paths[path]
const slug = path.split('/').at(-1)?.replace('.md', '')
if (file && typeof file === 'object' && 'metadata' in file && slug) {
const metadata = file.metadata as Omit<Post, 'slug'>
const post = { ...metadata, slug } satisfies Post
if (post.published) posts.push(post)
}
}
return posts.sort((first, second) =>
new Date(second.date).getTime() - new Date(first.date).getTime()
)
}