Building and Serving
Build a static site for publication or preview it while editing. You need
a Trail binary on your PATH and a source directory containing trail.toml.
For an empty directory, follow Building Your First
Site.
trail(1) documents the complete command interface.
Build the site #
-
Change to the directory containing
trail.toml. -
Build with description checks:
-
Check that the command exits successfully and reports the output directory. The page count counts HTML pages, including print pages. Markdown mirrors, search files, and static assets are additional files.
Output defaults to dist/. Use --out <directory> to choose another
location. The output directory is excluded from source scanning.
Own the output directory #
A successful build removes files it did not produce. Put additional files
such as CNAME in the source tree and configure
passthrough.
Do not keep manually managed files in dist/.
A failed build does not prune output. It can have written some files before failing, so the directory can contain a mixture of old and changed pages. Unchanged files retain their modification times.
Preview changes #
-
Start the development server from the source directory:
-
Open the address printed by the server. It defaults to
http://127.0.0.1:8724. -
Edit and save an article. Check that Trail reports a rebuild and the browser reloads the page.
-
Stop the server with Ctrl+C.
The server watches merged trees and declared plugin dependencies. It ignores output paths and hidden files, and periodically reconciles source contents to detect missed events. Build Cache explains reuse and invalidation.
A failed initial build or rebuild prints a warning and keeps the server running. Fix the reported source problem and save again. Output is not rolled back after a failure.
Diagnose a failure #
Trail reports errors on stderr with the invocation name and source context.
Usage errors also print a help pointer. Use trail help build to check
arguments, or trail build --no-cache to reproduce a build without cached
results.
Missing link targets fail builds by default. During a site reorganization,
--allow-dangling-links turns missing targets into warnings; ambiguous links
still fail. Resolve warnings before publishing.
--strict requires descriptions and warns about authored site-absolute
links. It does not enable link validation: links are validated on every
build. Writing Links and References
explains the linking syntax.
Publish other output forms #
The Output Surface describes Markdown
mirrors, print bundles, and discovery files. Use --render-llms-full when
you need additional llms-full.txt copies. Use --cbpath <path> to publish
a cache-busting copy.