New SvelteKit/Markdown approach

Published

Table of Contents

Now that SvelteKit switched to require the +page.md format, it is kind of annoying to have a markdown blog with SvelteKit, for one reason. When editing, it's hard to tell which files you have open, because they're all named +page.md.

Like I said, this is a small annoyance, and if you’re fine with the new file naming, then you can stop reading now and go write your blog.

Basic approach

The basic approach is to have your named markdown files somewhere in your project and use dynamic routing to serve them.

Alternatively, you can do what I did for my notes site and have your markdown files and website code separate. This is probably a better approach, to be honest, because then you don’t have to rebuild your site every time you edit something.

#coding/sveltekit #markdown

More posts: