SEO

The SEO module runs at build time and produces:

  • OG social card images — a .png generated for each page, referenced in <meta property="og:image">.
  • Canonical URL — <link rel="canonical" href="…"> on every built page that has og: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; the karaoke-cms/ handbook path is blocked by default. When site is set in astro.config.mjs, a Sitemap: line is added if the build output contains a sitemap (from @astrojs/sitemap).
  • llms.txt — generated at /llms.txt when site is set. It points crawlers and tools at the home page, sitemap, /rss.xml, and the JSON index below when enabled. Set llmsTxt: false to 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 with publish: true. Set contentManifest: false to 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

OptionTypeDefaultDescription
disallowstring[]['/karaoke-cms/']URL paths to block in robots.txt
llmsTxtbooleantrue (when site is set)When false, skip writing /llms.txt
llmsSiteTitlestringhostname# title at the top of llms.txt
llmsTxtExtrastring—Extra Markdown appended to llms.txt (your own sections and links)
contentManifestbooleantrue (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/.