Skip to main content

Introduction

Create, customize, and build a Doctocat site

Basic usage

Use the CLI to create your own Next.js + Doctocat site.

npx @primer/doctocat-nextjs@latest create

Follow the prompts to choose the output directory and site title.

Prefer to create the Next.js app yourself? See how to install Doctocat using create-next-app.

Reference

CommandDescription
createCreate a Doctocat site.
buildBuild a static export and route manifest.

Create options

OptionDescription
--target <directory>Output directory. Prompted for interactively.
--title <title>Site title. Prompted for interactively.
--base-path <path>Optional root-relative URL prefix without a trailing slash.
--static-exportEnable static export. Required for non-interactive creation.
--package-manager npmUse npm. Required for non-interactive creation.
--repository-url <url>Optional repository URL for source edit links.
--repository-source-path <path>Optional content path within the configured repository.
--forceWrite CLI scaffold files into a non-empty target.
-h, --helpShow command help.

Global options

OptionDescription
-V, --versionShow the installed Doctocat version.
-h, --helpShow CLI help.

For non-interactive environments:

npx @primer/doctocat-nextjs@latest create \ --target ./docs-site \ --title "Documentation" \ --static-export \ --package-manager npm

Author content

Put Markdown and MDX pages in content/. An index.mdx represents its directory route. Put static assets in public/ and reference them with root-relative paths.

Every page must have title and description frontmatter. Use menu-position to control navigation order. Customize the homepage in content/index.mdx and an imported component when needed.

After running the CLI

Run the following commands after creating your site with the CLI.

cd docs-site npm ci npm run dev npm run check npm run build