Guide

Getting started

From empty folder to a searchable, navigable doc site in four steps. This mirrors mkdocs-material → getting-started, so you can compare the workflows one-to-one.

1 · Project layout

A Pustaka site is a folder of HTML files plus a small registry. Pages can live in nested folders — this very page is guide/getting-started.html. There is no build step, no node_modules, no YAML config.

tree
my-docs/
├── index.html               ← landing page (root)
├── changelog.html           ← the product's release history
├── guide/                   ← group pages in folders, any depth
│   ├── getting-started.html
│   └── authoring.html       ← created with `pustaka new`
├── architecture/
│   └── app.html
└── assets/
    ├── toc.js               ← registry: site + product meta, parts list
    ├── toc/                 ← nav split into parts, < 200 lines each
    │   ├── overview.js
    │   ├── guide.js
    │   └── infra.js
    ├── site.css             ← design tokens + components
    └── site.js              ← shell, search, filters, HTMX swaps

Folder rule — one mechanical prefix

A page's asset links use ../ once per folder level: root → assets/site.css, guide/… → ../assets/site.css, guide/guide/deploy/… → ../../assets/site.csslt;subguide/deploy/… → ../../assets/site.cssgt;/… → ../../assets/site.css. pustaka new computes it for you and pustaka check enforces it.

Note

Compare with mkdocs: docs/*.md + mkdocs.yml. Here it is *.html + assets/toc.js. Same mental model, richer medium.

2 · Add your first page

Copy any existing page, keep the boilerplate, and write your content inside <main class="doc">. Everything else — header, sidebar, search, the “on this page” rail, prev/next — is generated for you.

hello.html
<body data-page="hello">
<div class="shell">
<main class="doc">

  <h1>Hello, Pustaka</h1>
  <p>Any HTML works here — including <canvas>,
  ECharts, forms, animation…</p>

</main></div>
<script src="assets/toc.js"></script>
<script src="assets/site.js"></script>
</body>

3 · Register it in the ToC

Append one object to assets/toc.js. The sections array doubles as the search index in this static prototype — in the Go version it is extracted from your HTML automatically.

assets/toc.js
{
  id:    "hello",
  file:  "hello.html",
  title: "Hello, Pustaka",
  desc:  "My first HTML-native doc page.",
  tags:  ["example", "hello"],
  sections: [
    { anchor: "intro", title: "Introduction",
      text: "Searchable summary of this section…" }
  ]
}

Tip

Reload and press Ctrl K — your page is already in global search, the sidebar, and the prev/next chain. That is the whole workflow.

4 · Run it

Two modes. The static mode is what you are looking at right now; the server mode is the production target.

shell
# nothing to install — open the folder
open index.html        # macOS
start index.html       # Windows
xdg-open index.html    # Linux
shell
# build once (stdlib only — no dependencies to download)
go build -o pustaka .

# validate pages (the AI authoring feedback loop)
./pustaka check ./docs

# serve: generated search index + HTMX partial navigation + gzip
./pustaka serve ./docs --addr :8080
dockerfile
FROM scratch
COPY pustaka /pustaka
COPY my-docs /docs
ENTRYPOINT ["/pustaka", "serve", "/docs"]

The Go CLI is real now

main.go at the repo root builds the pustaka binary — serve, check, and index commands, stdlib only. When served, this site auto-upgrades: the search index is generated from your HTML and sidebar clicks become partial swaps.