sqzass.git

sqzass

~ A static site generator written in Rust
git clone https://github.com/debuman/sqzass.git

docs/content/deploy/netlify.md (2421B)

      1 +++
      2 title = "Netlify"
      3 description = "netlify.toml, and deploy previews that build with the right base_url"
      4 weight = 20
      5 toc = true
      6 +++
      7 
      8 ```toml
      9 # netlify.toml
     10 [build]
     11   command   = "curl -sSL https://github.com/debuman/sqzass/releases/latest/download/sqzass-x86_64-unknown-linux-musl.tar.gz | tar xz --strip-components=1 && ./sqzass build"
     12   publish   = "public"
     13 
     14 [context.deploy-preview]
     15   command   = "curl -sSL https://github.com/debuman/sqzass/releases/latest/download/sqzass-x86_64-unknown-linux-musl.tar.gz | tar xz --strip-components=1 && ./sqzass build --base-url $DEPLOY_PRIME_URL"
     16 ```
     17 
     18 That is the whole configuration. No plugin, no build image, no runtime.
     19 
     20 ## Why the binary is downloaded rather than installed
     21 
     22 Netlify's build image has no Rust toolchain by default, and adding one costs
     23 minutes on every build. The Linux release is statically linked, so it runs in
     24 any image without matching a glibc version — which is the same property that
     25 makes it work in Alpine, in a scratch container, and on a machine older than the
     26 one that built it.
     27 
     28 If you would rather build from source, `cargo install --git
     29 https://github.com/debuman/sqzass` works too and is slower.
     30 
     31 ## Deploy previews need their own base_url
     32 
     33 A preview runs at `deploy-preview-42--yoursite.netlify.app`, not at your domain.
     34 Netlify puts that address in `$DEPLOY_PRIME_URL`, and `--base-url` overrides the
     35 config for exactly this case — so canonical links, the sitemap and OpenGraph
     36 tags describe the preview rather than pointing every crawler at production.
     37 
     38 Without it the preview still *works*, because internal links are root-absolute
     39 and do not care what the host is called. What breaks is everything absolute:
     40 `page.permalink`, `sitemap.xml`, and the social tags.
     41 
     42 ## Pretty URLs, redirects and headers
     43 
     44 Nothing to configure. Every page is a directory containing `index.html`, so
     45 Netlify serves `/start/` without a rewrite rule, and `/404.html` is picked up by
     46 name if you have a `templates/404.html`.
     47 
     48 `_redirects` and `_headers` are Netlify's own files and neither is required.
     49 If you want them, put them in `static/` and they are copied through untouched —
     50 `static/` is a passthrough, and files whose name is the contract keep their name.
     51 
     52 ```
     53 static/
     54 ├── _headers
     55 └── _redirects
     56 ```
     57 
     58 ## What this does not need
     59 
     60 No `netlify-plugin-*`, no `NODE_VERSION`, no `functions` directory. The output
     61 is a directory of files.