Blog
Blog
Static blog at /blog and /blog/:slug. Renders Markdown or JSON posts via content-collections.
Content source
Posts live in src/content/blog/ as .md or .mdx files. content-collections processes them at build time into typed collections.
File structure:
src/content/
└── blog/
├── my-first-post.md
└── getting-started.md
Frontmatter fields:
---
title: My Post Title
description: Short summary for SEO and cards.
date: 2026-01-15
published: true
---
Server functions
src/features/blog/server/blog.queries.ts:
listPosts-- returns all published posts sorted by date (GET, public)getPost({ slug })-- returns a single post by slug (GET, public)
Both are unauthenticated. No per-user SQLite involved.
Routes
src/routes/blog.tsx-- layout with<Outlet />src/routes/blog.index.tsx-- post list pagesrc/routes/blog.$slug.tsx-- single post page
SEO
Posts use createSeo() from @/lib/seo for per-page meta tags. Set title, description, and ogImage in the route's head() function.
Adding a post
- Create
content/blog/my-slug.mdwith required frontmatter - Set
published: trueto make it visible - The post appears automatically at
/blog/my-slug