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 8d9d82d..178f126 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,14 @@ fi "$zola" --version node scripts/release.mjs -"$zola" build + +# 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 if [ "${RENDERD_SKIP_API:-0}" != "1" ]; then # set -e does not work inside an if condition, so each step is chained with &&. 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 @@
The address may be old, or it may have a typo. These pages are here:
+