Downloading and self-hosting
Cruma hosts your site for you, but you can also take the built site and serve it yourself. A build comes in two forms, and a single file is the default.
| Single file (default) | Multi-file (clean URLs) | |
|---|---|---|
| What you get | One index.html (.html download) | A folder with an index.html for every page (.zip download) |
| Page addresses | /#pricing, /#guide/setup | /pricing, /book/guide/setup/ |
| Search engines see | One URL for the whole site | Every page, post and chapter at its own URL, with its own title and description |
| Where it works | Any static server, or opened straight from disk | The root of any static server |
Downloading from the dashboard
In the site editor's ⋯ menu:
- Download built site saves the single file.
- Download built site (multi-file) saves a
.zipof the multi-file build. Unzip it and serve the folder.
Building with the command line
build-site is the generator Cruma runs on every push. It is not published
as a download: it is built from the generator's source with
cargo install --path ., so it is for teams that run the generator
themselves. Everyone else downloads from the dashboard, as above.
build-site builds a site from its folder (site.toml and content/):
# The single file (the default), written to index.html
build-site build
# The multi-file build, written to site/
build-site build --multi-file --base-url https://example.com --out site
--out names the output folder (default site). The build adds and replaces
files in that folder but never deletes any, so give each site a folder of its
own.
--base-url is the address the site is served at. With it, each page has a
canonical link, an og:url and its structured data,
and the build writes a sitemap.xml that lists every page at its real URL.
Without it, those are left out, as in the single file. The dashboard
download has no base URL, so it has no canonical links and no sitemap.xml.
What the multi-file build contains
| File | What it is |
|---|---|
index.html | The default page |
pricing/index.html | A page |
book/<book>/<chapter>/index.html | A book chapter |
blog/index.html, blog/<post>/index.html | The blog index and each post |
404.html | The 404 page, which many static hosts show for unknown paths |
book/*.html, book/search-*.json | The page and chapter content and the search index the pages load |
fonts/, images/ | The site's fonts and content/images/ |
llms.txt, llms-full.txt | Copied from content/ when the site has them |
sitemap.xml | Only with --base-url |
Each page's file is the same HTML that a Cruma-hosted site sends for that URL. It has the page's own title, description and link preview, and its content is already in the HTML, so search engines and other readers without JavaScript see the page. Links between pages point at real paths.
Serving it
Copy the folder to any static host or server, such as nginx, Caddy, GitHub Pages or an object-storage bucket. No rewrite rules are needed. To try it locally:
cd site
python3 -m http.server 8000
Opening or refreshing any page's URL loads that page's own file. Clicking a link between pages switches pages in place without reloading, as on a Cruma-hosted site, and Back and Forward move between them.
Serve the folder at the root of its host (https://example.com/), not
under a sub-path such as https://example.com/docs/: the pages load their
content, fonts and images from root paths like /book/… and /fonts/….
A static server usually redirects /pricing to /pricing/ because the
page is the folder's index.html. The page's canonical link still names
/pricing, the same URL a Cruma-hosted site uses.
When to use which
- Single file: for opening the site straight from disk, sending it as an attachment, or serving it anywhere crawlers and per-page URLs don't matter.
- Multi-file: for hosting the site yourself as a public website: every page can be found, shared and indexed at its own URL.
Features that need Cruma's servers keep working only on a Cruma-hosted site:
analytics, private sites and
Markdown versions of pages. If
markdown-view is on, a downloaded site still shows the View as Markdown
link, but on a static server it opens the same HTML page, because only
Cruma's servers answer ?format=markdown.