forge site deploy sets FORGE_SITE_URL and FORGE_SITE_BASE; without them the docs still build for the root of lofi.host exactly as before. Under a path the docs emit each route as a directory with an index.html, since that host is a plain file server, and the PWA manifest and head links follow the base. .forge/sites declares two sites: docs, built by .forge/site-docs the way the site workflow does (lofi-node at the pinned LOFI_NODE_REF), and app, the reference app built with LOFI_BASE_PATH set to the deploy path. They deploy to https://pages.src.rest/sites/cat/lofi/docs/ and .../app/.
- commit
- 683e6fcd51e9c139e9b9c0c99b792efe8f0a42a1
- parent
- dbd094e2155a7cc2b4c34f6b709336850aa2d0f8
- author
- cat <admin@dev.site>
| A | .forge/ | 17 | +++++++++++++++++ |
| A | .forge/ | 3 | +++ |
| M | website/ | 17 | ++++++++++++----- |
| M | website/ | 12 | ++++++------ |
@@ -0,0 +1,17 @@
1+2+# Builds the docs site for `forge site deploy docs` the way3+# .github/workflows/site.yml does: the /node section renders from lofi-node at4+# the ref that workflow pins, cloned from the forge this repo came from.5+set -eu6+ref=$(sed -n 's/^ LOFI_NODE_REF: *//p' .github/workflows/site.yml)7+[ -n "$ref" ] || { echo "no LOFI_NODE_REF in .github/workflows/site.yml" >&2; exit 1; }8+LOFI_NODE_DIR=lofi-node-checkout LOFI_NODE_REF=$ref9+export LOFI_NODE_DIR LOFI_NODE_REF10+rm -rf "$LOFI_NODE_DIR"11+git clone -q "$(git remote get-url origin | sed 's|lofi\(\.git\)\{0,1\}$|lofi-node.git|')" "$LOFI_NODE_DIR"12+git -C "$LOFI_NODE_DIR" checkout -q --detach "$ref"13+# llms.txt names absolute URLs; point them at where this build is served.14+if [ -n "${FORGE_SITE_URL:-}" ]; then SITE_URL=${FORGE_SITE_URL%/}; export SITE_URL; fi15+deno task site:gen16+npm ci --prefix website17+npm run build --prefix website@@ -23,6 +23,13 @@ try {
2323 // Keep the fallback label.2424 }2525 26+// The site is served at the root of lofi.host. `forge site deploy` serves it27+// under a path instead and says where with FORGE_SITE_URL and FORGE_SITE_BASE.28+// That host is a plain file server with no `<path>.html` fallback, so forge29+// builds emit every route as a directory with an index.html.30+const forgeSite = process.env.FORGE_SITE_URL ? new URL(process.env.FORGE_SITE_URL) : null;31+const baseUrl = process.env.FORGE_SITE_BASE || "/";32+2633 // Fonts must ship as files, not base64 in the render-blocking stylesheet —2734 // webpack's default inline threshold would bloat styles.css by hundreds of KB.2835 // Rewrites Docusaurus's own font rule in place: appending a second rule makes@@ -57,9 +64,9 @@ const config: Config = {
5764 v4: true,5865 },5966 60- url: "https://lofi.host",61- baseUrl: "/",62- trailingSlash: false,67+ url: forgeSite?.origin || "https://lofi.host",68+ baseUrl,69+ trailingSlash: forgeSite !== null,6370 6471 onBrokenLinks: "throw",6572 onBrokenAnchors: "warn",@@ -120,7 +127,7 @@ const config: Config = {
120127 "queryString",121128 ],122129 pwaHead: [123- { tagName: "link", rel: "manifest", href: "/manifest.json" },130+ { tagName: "link", rel: "manifest", href: `${baseUrl}manifest.json` },124131 { tagName: "meta", name: "theme-color", content: "#18231f" },125132 {126133 tagName: "meta",@@ -135,7 +142,7 @@ const config: Config = {
135142 {136143 tagName: "link",137144 rel: "apple-touch-icon",138- href: "/img/pwa/icon-192.png",145+ href: `${baseUrl}img/pwa/icon-192.png`,139146 },140147 ],141148 },@@ -2,32 +2,32 @@
22 "name": "lofi — local-first framework docs",33 "short_name": "lofi",44 "description": "Documentation for lofi and lofi-node: local-first apps, user-owned sync. Installs and reads offline.",5- "start_url": "/",6- "scope": "/",5+ "start_url": "./",6+ "scope": "./",77 "display": "standalone",88 "background_color": "#18231f",99 "theme_color": "#18231f",1010 "icons": [1111 {12- "src": "/img/pwa/icon-192.png",12+ "src": "img/pwa/icon-192.png",1313 "sizes": "192x192",1414 "type": "image/png",1515 "purpose": "any"1616 },1717 {18- "src": "/img/pwa/icon-512.png",18+ "src": "img/pwa/icon-512.png",1919 "sizes": "512x512",2020 "type": "image/png",2121 "purpose": "any"2222 },2323 {24- "src": "/img/pwa/icon-192.png",24+ "src": "img/pwa/icon-192.png",2525 "sizes": "192x192",2626 "type": "image/png",2727 "purpose": "maskable"2828 },2929 {30- "src": "/img/pwa/icon-512.png",30+ "src": "img/pwa/icon-512.png",3131 "sizes": "512x512",3232 "type": "image/png",3333 "purpose": "maskable"