introduction #

fuz_blog is a SvelteKit blog template and a library for adding blogs to existing projects. Posts are Svelte components that export their own metadata, and gro gen validates them to produce an Atom feed, a runtime feed module, and human-readable slug routes. Everything is statically generated -- no database, no admin interface -- and comments are opt-in through Mastodon. See the API reference for the full surface.

Install
#

Published as @fuzdev/fuz_blog to npm:

npm i -D @fuzdev/fuz_blog

Declare your blogs
#

Declare your blogs in src/routes/blogs.ts — one entry per blog, each with a route dirname and feed metadata:

// src/routes/blogs.ts import type {BlogConfig} from '@fuzdev/fuz_blog/blog.ts'; export const blogs: Array<BlogConfig> = [ { dirname: 'blog', feed: { title: 'my blog', home_page_url: 'https://www.example.com/blog', // ...the rest of the feed metadata }, }, ];

See BlogConfig for the rest of the options, like disabling generated slug routes or customizing what gro post scaffolds.

Publish the feed
#

To enable your generated feed.xml, include it as a link in your layout:

<!-- src/routes/+layout.svelte --> <script lang="ts"> import {blog_feed_context} from '@fuzdev/fuz_blog/blog.ts'; import {feed} from '$routes/blog/feed.ts'; blog_feed_context.set(feed); </script> <svelte:head> <title>(your title here)</title> <link rel="alternate" type="application/atom+xml" title="Atom" href={feed.atom.feed_url} /> </svelte:head>

With more than one blog, set each blog's feed in its own src/routes/<dirname>/+layout.svelte so its pages read the right context.

Create a new post
#

$ gro post "Some post title" $ gro post --help

Update an existing post
#

$ gro update_post 1 $ gro update_post --help