gramr preview shows the site as it would be published, on your machine.

gramr preview blog              # http://localhost:8080
gramr preview blog --port 3000  # http://localhost:3000

It runs the same steps as publish, then:

  1. builds the image for your machine only (the platforms of gramr.toml are ignored) and loads it into your local Docker, without pushing it;
  2. runs it, with the local port mapped to the port the image EXPOSEs (80 if none);
  3. on Ctrl+C, stops and removes the container, then removes the image.

Zola writes absolute links from the base_url of its config.toml, so a preview would link to your production site. gramr passes --build-arg BASE_URL=http://localhost:<port> to preview builds, and the Dockerfile created by gramr init uses it:

ARG BASE_URL
RUN zola build ${BASE_URL:+--base-url "$BASE_URL"}

If you wrote your own Dockerfile, add these two lines. gramr doctor warns when a Dockerfile does not use BASE_URL. publish does not pass it, so the base_url of your configuration is used.

Working on the theme

To iterate on templates with zola serve and live reload, keep the workspace gramr built:

gramr preview blog --keep-workspace

gramr prints its path. Run zola serve in it: it contains your site repository plus the generated pages.

Checking without building

gramr publish blog --dry-run stops before the build and prints the pages, attachments, removed links and tags. It is the fastest way to check that every note is valid.