commit 216c64d796719c5939d1f46f3a5491aea5bcc95d parent 590ca42b0103e0743dbab9264e00b40365b018c1 Author: Yersa Nordman <yersa@finwo.nl> Date: Tue, 14 Mar 2023 22:13:35 +0100 Emulate optional prefix on routes for github.io Diffstat:
| M | doc/build.js | | | 2 | +- |
| M | doc/src/app.svelte | | | 13 | +++++++++++-- |
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/doc/build.js b/doc/build.js @@ -6,7 +6,7 @@ const esbuildSvelte = require('esbuild-svelte'); const preprocess = require('svelte-preprocess'); const pkg = require('./package.json'); -const pageroot = process.env.PAGE_ROOT || ''; +const pageroot = process.env.PAGE_ROOT || '/'; // Simple for now const entryPoints = { diff --git a/doc/src/app.svelte b/doc/src/app.svelte @@ -3,7 +3,16 @@ import HomePage from './page/home.svelte'; import NotFoundPage from './page/not-found.svelte'; + + // Emulate optional prefix + let prefix = '/*'; + if (document.location.host == 'finwo.github.io') { + prefix = '/pmlag/*'; + } + </script> -<Route path="/"><HomePage/></Route> -<Route fallback><NotFoundPage/></Route> +<Route path={prefix} > + <Route path="/"><HomePage/></Route> + <Route fallback><NotFoundPage/></Route> +</Route>