Last updated on Edit this page

Deploying

The output folder is a self-contained static site. Publishing it means copying the folder to a web host and, ideally, telling the host to serve 404.html for addresses the site does not have.

Before publishing, set the site's public address so that canonical links, link previews, the sitemap, and the cross-reference map use it:

JSON
"globalMetadata": { "_baseUrl": "https://docs.example.com" },
"sitemap": { "baseUrl": "https://docs.example.com" }

Every build host needs Pudu. Install the release you develop with and verify its checksum:

Shell
version=0.1.2
archive="pudu-${version}-linux-amd64.tar.gz"
base="https://github.com/chrismichaelps/pudu-lang/releases/download/v${version}"
curl -fsSLO "$base/$archive"
curl -fsSLO "$base/$archive.sha256"
sha256sum -c "$archive.sha256"
tar -xzf "$archive"
export PATH="$PWD/pudu-${version}-linux-amd64/bin:$PATH"

This site is deployed to Vercel from its website folder. Its vercel.json runs a build script, publishes _site, and sets security and caching headers:

JSON
{
  "buildCommand": "bash vercel-build.sh",
  "outputDirectory": "_site",
  "cleanUrls": false
}

When the whole repository is available, as in a Git deployment with the project's root directory set to website, the script installs Pudu as shown above, runs pudu install at the repository root for the package's dependencies, and builds the site. When only the website folder is uploaded, it publishes the site already built in _site:

Shell
pudu run examples/Cli.pudu build website
cd website
vercel deploy --prod

Vercel serves 404.html from the output folder for any address the site does not have.

Checklist

  • The build runs with no warnings. Consider --warningsAsErrors in continuous integration.
  • _baseUrl and sitemap.baseUrl name the public address.
  • The build host clones the repository with history if last-modified dates matter.
  • gitContribute names the repository and branch, so Edit this page links point at the right files.
  • The host serves 404.html for missing addresses.