Skip to main content

Publish Docs from Markdown with the LitPage CLI

Find or create the documentation root and folder, publish a Markdown article, and verify where it appears in the public documentation.

Use this workflow to publish a help article from your project to an existing LitPage documentation site. You will choose a root and folder before you write the article, so readers can find it in the public navigation after publication.

Choose a root and folder

Confirm the site and language. The roots are the top-level tabs in the documentation. A folder or group divides one root into related topics. The editing tree shows the slugs you can use in a file.

npx @litpage/cli docs roots --subdomain your-site --language EN
npx @litpage/cli docs tree --subdomain your-site --language EN

If the right containers already exist, use their slugs. To create new containers on a test site with write access, use distinct names and slugs.

npx @litpage/cli docs create-root --name Guides --slug guides --language EN --subdomain your-site
npx @litpage/cli docs create-folder --root guides --name Setup --slug guide-setup --language EN --subdomain your-site

Choose the root and folder in the same language. Empty containers become useful to readers after a linked article is published.

Generate a Markdown document

npx @litpage/cli docs template ./getting-ready.md --root guides --parent guide-setup --slug getting-ready --language EN --subdomain your-site --doc-type tutorial
npx @litpage/cli content validate ./getting-ready.md

Replace template prose with the actual instructions before validating again. Keep the versioned frontmatter, including docType, difficulty, summary, and seo. Write the article title in metadata and use H2 for body sections. Use root for the exact root slug and parent for the folder path relative to it. Omit the parent option for a template that lives directly under the root.

The offline validator checks the file and metadata syntax. Use the tree and Builder to verify the real destination. If a folder was moved, refresh the editing tree before creating or saving an article.

Review and publish the article

npx @litpage/cli apply ./getting-ready.md --subdomain your-site
npx @litpage/cli publish ./getting-ready.md --subdomain your-site

Run npx @litpage/cli apply first and stop to inspect the document in Builder. Confirm the title, language, root, folder, and preview. Run the second command after reviewing the draft. Open the public result from the receipt or Builder, then confirm that the expected root is selected and the article link appears in its folder.

The public detail route is based on the article slug under /docs, with a language prefix where configured. Changing a folder does not require changing the article URL.

Keep editing an existing article

npx @litpage/cli content pull --type DOC --slug getting-ready --language EN --subdomain your-site --out getting-ready-current.md

The export contains the current directory and revision fields. Keep the revision baseline to avoid overwriting a newer edit. Move an existing document in Builder if its location needs to change, then pull it again to refresh the file. For writing a dated article outside the documentation center, follow the blog publishing tutorial.