From 8ceeff78f44481730f1b3072d8b25f8eeac39294 Mon Sep 17 00:00:00 2001 From: Ad1th <90973387+Ad1th@users.noreply.github.com> Date: Sun, 18 Oct 2026 13:56:15 +0000 Subject: [PATCH 1/2] fix(docs): build Vercel previews with their own address Zola writes absolute links from base_url, so a preview loaded its CSS, fonts and images from renderd.xyz. Previews now use VERCEL_URL, and RENDERD_BASE_URL can set the address for production while DNS is not ready. --- site/build.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/site/build.sh b/site/build.sh index 8d9d82d..8c38ccb 100755 --- a/site/build.sh +++ b/site/build.sh @@ -5,7 +5,7 @@ # 2. Write data/release.json from the latest GitHub release. # 3. zola build. # 4. Add rustdoc at /api/. If that fails, the site still ships without it. -# Set RENDERD_SKIP_API=1 to skip step 4. +# Set RENDERD_SKIP_API=1 to skip step 4. RENDERD_BASE_URL sets the site address. set -euo pipefail cd "$(dirname "$0")" @@ -25,7 +25,20 @@ fi "$zola" --version node scripts/release.mjs -"$zola" build + +# Zola writes absolute links from base_url. Production uses renderd.xyz (config.toml); +# a Vercel preview uses its own address, or its CSS and fonts would load from +# production. RENDERD_BASE_URL overrides both, for example while DNS is not ready. +base_url="${RENDERD_BASE_URL:-}" +if [ -z "$base_url" ] && [ "${VERCEL_ENV:-}" = "preview" ] && [ -n "${VERCEL_URL:-}" ]; then + base_url="https://$VERCEL_URL" +fi +if [ -n "$base_url" ]; then + echo "base_url: $base_url" + "$zola" build --base-url "$base_url" +else + "$zola" build +fi if [ "${RENDERD_SKIP_API:-0}" != "1" ]; then # set -e does not work inside an if condition, so each step is chained with &&. From f2a976523386c229ef8d2a2a92c604b57a0ee7d4 Mon Sep 17 00:00:00 2001 From: Ad1th <90973387+Ad1th@users.noreply.github.com> Date: Sun, 18 Oct 2026 14:09:20 +0000 Subject: [PATCH 2/2] fix(site): load CSS, fonts and images on any host Pages now link to assets and to each other with root-relative paths, so the site renders on the vercel.app address and on renderd.xyz alike. Only the canonical, og and sitemap URLs stay absolute on renderd.xyz. No env var is needed on Vercel. --- .github/workflows/site.yml | 5 +++-- site/build.sh | 14 ++++---------- site/templates/404.html | 4 ++-- site/templates/base.html | 22 +++++++++++----------- site/templates/index.html | 4 ++-- 5 files changed, 22 insertions(+), 27 deletions(-) diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 5aeaead..eb2d4bd 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -27,12 +27,13 @@ jobs: echo "${LYCHEE_SHA256} /tmp/lychee.tgz" | sha256sum -c - tar -xzf /tmp/lychee.tgz -C /tmp lychee /tmp/lychee --offline --no-progress --include-fragments --index-files index.html \ + --root-dir "$PWD/site/public" \ --remap "https://renderd\.xyz/(.*) file://$PWD/site/public/\$1" \ 'site/public/**/*.html' - name: Lighthouse (mobile budgets) run: | - # build.sh left Zola here; rebuild with a local address so the assets load. - (cd site && /tmp/renderd-site-tools/zola-0.23.6 build --base-url http://127.0.0.1:8090 -o /tmp/renderd-site-lh --force) + # Serve the build output as is, the same files Vercel serves. + cp -r site/public /tmp/renderd-site-lh npx --yes @lhci/cli@0.15.1 autorun --config=site/lighthouserc.json - name: Keep the Lighthouse reports if: always() diff --git a/site/build.sh b/site/build.sh index 8c38ccb..178f126 100755 --- a/site/build.sh +++ b/site/build.sh @@ -26,16 +26,10 @@ fi node scripts/release.mjs -# Zola writes absolute links from base_url. Production uses renderd.xyz (config.toml); -# a Vercel preview uses its own address, or its CSS and fonts would load from -# production. RENDERD_BASE_URL overrides both, for example while DNS is not ready. -base_url="${RENDERD_BASE_URL:-}" -if [ -z "$base_url" ] && [ "${VERCEL_ENV:-}" = "preview" ] && [ -n "${VERCEL_URL:-}" ]; then - base_url="https://$VERCEL_URL" -fi -if [ -n "$base_url" ]; then - echo "base_url: $base_url" - "$zola" build --base-url "$base_url" +# Pages link to CSS, fonts and images with root-relative paths, so they load on +# any host. base_url (renderd.xyz) is only for canonical, og and sitemap URLs. +if [ -n "${RENDERD_BASE_URL:-}" ]; then + "$zola" build --base-url "$RENDERD_BASE_URL" else "$zola" build fi diff --git a/site/templates/404.html b/site/templates/404.html index 6b8ec16..847a4cd 100644 --- a/site/templates/404.html +++ b/site/templates/404.html @@ -13,8 +13,8 @@

This page is not in the book.

The address may be old, or it may have a typo. These pages are here:

diff --git a/site/templates/base.html b/site/templates/base.html index 9c60b20..6e491b0 100644 --- a/site/templates/base.html +++ b/site/templates/base.html @@ -16,26 +16,26 @@ - + - - - - + + + + {% block head %}{% endblock head %}
- Renderd + Renderd
diff --git a/site/templates/index.html b/site/templates/index.html index bbb257d..df2e4ee 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -61,7 +61,7 @@

Use your Windows PC as a second monitor for y
- A MacBook and a Windows PC monitor side by side. One window is half on the MacBook screen and half on the monitor, because the monitor is now the Mac's second display. + A MacBook and a Windows PC monitor side by side. One window is half on the MacBook screen and half on the monitor, because the monitor is now the Mac's second display.

One frame, taken apart.

{%- set fw = 300 -%}{%- set fh = 168.75 -%}{%- set sh = fh / 8 -%} - + {%- for i in range(end=8) %} {%- endfor %}