Blog Module
The blog module publishes a post listing at /blog, individual posts at /blog/[slug], and paginated list pages at /blog/page/[page]. It also registers an RSS feed at /rss.xml in the footer menu automatically.
Adding the blog module
In karaoke.config.ts:
import { defineConfig } from '@karaoke-cms/astro';
import { blog } from '@karaoke-cms/module-blog';
import { themeDefault } from '@karaoke-cms/theme-default';
export default defineConfig({
vault: env.KARAOKE_VAULT,
title: 'My Site',
theme: themeDefault(),
modules: [
blog(),
],
});
Options
| Option | Default | Description |
|---|---|---|
mount | /blog | URL prefix for all blog routes |
id | 'blog' | Internal identifier and Astro collection name |
folder | mount without / | Vault subfolder containing blog post files |
comments | true | Default comments visibility for all posts |
enabled | true | Set false to exclude the module from the build |
blog({
mount: '/blog',
comments: true,
enabled: true,
})
Routes injected
| Route | Description |
|---|---|
/blog | Post listing (most recent first) |
/blog/[slug] | Individual post page |
/blog/page/[page] | Paginated listing |
/rss.xml | RSS feed (registered in the footer menu) |
Writing a blog post
Create a .md file in your vault’s blog/ folder. Required frontmatter:
---
title: "My First Post"
publish: true
date: 2024-03-15
---
Post content here.
publish: true is required for the post to appear on the site. Without it the file is treated as private and excluded from the build.
Optional frontmatter
---
title: "My First Post"
publish: true
date: 2024-03-15
author: "Jane Smith"
description: "A short summary shown in the post listing and meta tags."
tags: [astro, obsidian]
featured_image: "/images/hero.jpg"
reading_time: 5
---
| Field | Description |
|---|---|
author | Displayed on the post page |
description | Summary for listing cards and SEO meta tags |
tags | List of tags — picked up by the tags module |
featured_image | Path to a hero image shown on the post and listing card |
reading_time | Estimated reading time in minutes |
Featured posts
Add featured_image to any post to display a hero image at the top of the post page and as a card image in the listing. The value is a path relative to your public/ folder or an absolute URL:
featured_image: "/images/my-hero.jpg"
Comments
By default all blog posts show a comments section. To disable comments on a specific post, add comments: false to its frontmatter:
---
title: "A Post Without Comments"
publish: true
date: 2024-03-15
comments: false
---
To disable comments on all posts by default, pass comments: false to the module:
blog({ comments: false })
Individual posts can still override the module default by setting comments: true in frontmatter.
Comments require the comments() module to be configured. See the configuration reference for setup instructions.
RSS
The blog module automatically registers /rss.xml and adds an RSS link to the footer menu. No additional configuration is needed.