CLI Command Reference
TUI (Interactive Launcher)
Run npx better-seo with no subcommand in a TTY → opens interactive menu.
Disabled in CI or with --no-interactive / -y /
CI=true / BETTER_SEO_CI=1 / BETTER_SEO_NO_TUI=1.
Assets
og
Generate Open Graph card (1200×630 PNG).
better-seo og "Title" -o ./public/og.png --site-name "Brand" [--theme dark] [--template ./card.mjs]
| Flag | Default | Notes |
|---|---|---|
-o, --output |
./og.png |
Output path |
--site-name |
— | Brand name on card |
--theme |
light |
light | dark | auto |
--template |
built-in | Compiled .js/.mjs module |
--logo |
— | Local path or URL |
icons
Generate favicon set + web manifest.
better-seo icons --input ./logo.png --out ./public [--manifest]
| Flag | Default | Notes |
|---|---|---|
--input |
required | Source image (PNG, SVG, etc.) |
--output |
./public |
Output directory |
--manifest |
false | Write manifest.json |
Setup
init
Print install snippet + framework-specific setup instructions.
better-seo init [--framework next|react]
doctor
Validate environment: Node version, peer dependencies, adapter registration.
better-seo doctor [--json]
migrate
Migration hints from next-seo or other tools.
better-seo migrate from-next-seo
Content
content from-mdx
Extract SEOInput from MDX frontmatter.
better-seo content from-mdx --input ./post.mdx --out ./seo-input.json
Trust & Debug
snapshot
Write current SEO tags to JSON for diffing.
better-seo snapshot --url http://localhost:3000 --output ./snapshot-a.json
snapshot compare
better-seo snapshot compare ./snapshot-a.json ./snapshot-b.json
preview
Generate static HTML preview of head tags.
better-seo preview --input ./seo-input.json [--open]
analyze
Run validateSEO with exit codes (CI-friendly).
better-seo analyze --input ./seo-input.json
Exit 1 if errors found (warnings don't fail by default).
Crawl
crawl robots
Generate robots.txt.
better-seo crawl robots --out ./public/robots.txt --sitemap https://example.com/sitemap.xml
crawl sitemap
Generate sitemap.xml from URL list.
better-seo crawl sitemap --out ./public/sitemap.xml --urls https://example.com/,https://example.com/about
Templates
template list
List available industry presets (blog, docs, SaaS, ecommerce, portfolio).
template preview
Show template bundle (rules, schema presets) without applying.
template switch
Apply template to existing config (non-destructive merge).
Automation
scan
Detect SEO issues in codebase (missing titles, descriptions, canonicals).
better-seo scan ./src --framework next
fix
Auto-fix detected issues (idempotent, --dry-run available).
better-seo fix ./src --dry-run
add
Add SEO boilerplate to a project (config file, adapter setup).
Global Flags
| Flag | Description |
|---|---|
--no-interactive, -y, --yes |
Skip TUI |
--no-interactive (on bare invoke) |
Print help, exit 1 |
--help |
Show command help |
--version |
Print CLI version |