clone

a deno framework for local-first web apps that open instantly, work offline and sync when users choose

chore(site): build the docs and the reference app under a forge path

cat committed 683e6fc
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>
4 files changed, +38 -11
A.forge/site-docs17+++++++++++++++++
A.forge/sites3+++
Mwebsite/docusaurus.config.ts17++++++++++++-----
Mwebsite/static/manifest.json12++++++------
A .forge/site-docs +17 -0
A .forge/sites +3 -0
M website/docusaurus.config.ts +12 -5
@@ -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 },
M website/static/manifest.json +6 -6