SEO
The SEO module runs at build time and produces:
- OG social card images — a
.pnggenerated for each page, referenced in<meta property="og:image">. - Canonical URL —
<link rel="canonical" href="…">on every built page that hasog:url, matching that URL (build-time pass). - JSON-LD structured data — Article schema added to every published page’s
<head>. - robots.txt — generated at
/robots.txt; thekaraoke-cms/handbook path is blocked by default. Whensiteis set inastro.config.mjs, aSitemap:line is added if the build output contains a sitemap (from@astrojs/sitemap). - llms.txt — generated at
/llms.txtwhensiteis set. It points crawlers and tools at the home page, sitemap,/rss.xml, and the JSON index below when enabled. SetllmsTxt: falseto turn it off. - karaoke-public-content.json — build-time index of public pages (URL, title, description, dates when present in
<meta>). Derived from the same shipped HTML as the site, so it stays aligned withpublish: true. SetcontentManifest: falseto turn it off.
No configuration is required. Add seo() to modules[] and you’re done.
Add the module
// karaoke.config.ts
import { defineConfig } from '@karaoke-cms/astro';
import { seo } from '@karaoke-cms/module-seo';
export default defineConfig({
modules: [
seo(),
],
});
Custom robots.txt
The default disallow list blocks /karaoke-cms/ — the dev-only handbook that is never deployed publicly. Add any additional paths you want crawlers to skip:
seo({
disallow: ['/karaoke-cms/', '/private/'],
})
Config options
| Option | Type | Default | Description |
|---|---|---|---|
disallow | string[] | ['/karaoke-cms/'] | URL paths to block in robots.txt |
llmsTxt | boolean | true (when site is set) | When false, skip writing /llms.txt |
llmsSiteTitle | string | hostname | # title at the top of llms.txt |
llmsTxtExtra | string | — | Extra Markdown appended to llms.txt (your own sections and links) |
contentManifest | boolean | true (when site is set) | When false, skip karaoke-public-content.json |
Build-time only
OG image generation runs in the astro:build:done hook. Images are not generated in dev mode (pnpm dev). To preview a generated OG image, run pnpm build and check dist/.