Skip to content
New to Sumi? Read the introduction.
Sumi
On this page

Domains and previews#

Your own domain#

  1. Add a DNS record with your domain provider. For a subdomain such as docs.example.com, a CNAME record pointing to the host: <user>.github.io for GitHub Pages, the *.pages.dev address for Cloudflare Pages, or the *.netlify.app address for Netlify. For an apex domain such as example.com, follow the host's guide: GitHub, Cloudflare, Netlify.
  2. Enter the domain in the host's settings. On GitHub, that is Settings → Pages → Custom domain; turn on Enforce HTTPS once the certificate is ready.
  3. Set site_url to the new address:
mkdocs.yml
site_url: https://docs.example.com/

site_url is where the sitemap, the feed, llms.txt, social previews and canonical links point. Without it, they are missing or incomplete.

Note

With mkdocs gh-deploy, GitHub reads the domain from a CNAME file in the published branch. Put a file named CNAME holding the domain in docs/, and every build copies it along. A GitHub Actions deployment does not need the file.

Moving to a new domain#

Readers and search engines still have the old links. Most hosts can redirect a whole domain: keep the old domain attached and add a redirect rule to the new one, path included. For moved pages inside one site, the mkdocs-redirects plugin writes small pages that forward to the new address.

Preview before publishing#

Your machine
mkdocs serve rebuilds on every save and reloads the browser. If a page looks different from a full build, mkdocs serve --clean turns off the preview server's caches.
A built copy
mkdocs build and then python -m http.server -d site, to see the real output. Opening site/index.html from the file system is not enough: browsers block search and fonts on file:// pages.
Pull requests on Cloudflare or Netlify
Every branch and pull request gets its own preview address, posted on the pull request.
Pull requests on GitHub Pages
GitHub Pages serves one version of a site. The workflow still builds pull requests with --strict, which catches broken links. To browse a preview, check out the branch and build it locally, or let Cloudflare or Netlify deploy previews.

Search engines should not index previews. Preview hosts usually add an X-Robots-Tag: noindex header to preview addresses; check yours if previews show up in search results.

Several versions#

To keep the documentation of older releases online, publish each version to its own folder with mike. Sumi then shows a version menu in the header and a notice on old versions. See Navigation.

Several languages#

A translated site is one build: each language is written to its own folder, such as /zh/. See Languages. Nothing changes for deployment.

Esc
↵ to open ↑↓ to move Esc to close
Keyboard shortcuts
Ctrl K /
Open search and commands
t
Toggle dark mode
[ ]
Previous / next page
j k
Previous / next heading
- =
Narrower / wider text
o
Collapse or expand all
b
Bilingual view
?
Show this help
Bilingual view
English
简体中文