Skip to content

Commit 895ea12

Browse files
sirdeggenclaude
andcommitted
fix: set base /ts-stack/ for GitHub Pages subdirectory deployment
Without base, Vite emits /assets/... paths which 404 on GitHub Pages (served under /ts-stack/). Also fixes React Router basename so NavLink renders correct hrefs, iframe asyncapi src, pagefind load path, and Footer plain <a> → Link. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8b110f5 commit 895ea12

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

docs-site/src/components/Footer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Link } from 'react-router-dom'
12
import styles from './Footer.module.css'
23

34
export default function Footer() {
@@ -10,8 +11,8 @@ export default function Footer() {
1011
</span>
1112
<nav className={styles.links} aria-label="Footer navigation">
1213
<a href="https://github.com/bsv-blockchain/ts-stack">GitHub</a>
13-
<a href="/about/contributing/">Contributing</a>
14-
<a href="/about/versioning/">Versioning</a>
14+
<Link to="/about/contributing/">Contributing</Link>
15+
<Link to="/about/versioning/">Versioning</Link>
1516
</nav>
1617
</div>
1718
</footer>

docs-site/src/components/SearchBox.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ let pagefindPromise: Promise<Pagefind> | null = null
2121

2222
function loadPagefind(): Promise<Pagefind> {
2323
if (!pagefindPromise) {
24-
pagefindPromise = import(/* @vite-ignore */ '/_pagefind/pagefind.js') as Promise<Pagefind>
24+
const base = import.meta.env.BASE_URL.replace(/\/$/, '')
25+
pagefindPromise = import(/* @vite-ignore */ `${base}/_pagefind/pagefind.js`) as Promise<Pagefind>
2526
}
2627
return pagefindPromise
2728
}

docs-site/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ import './styles/reset.css'
55
import './styles/code.css'
66
import './styles/callout.css'
77

8-
export const createRoot = ViteReactSSG({ routes })
8+
export const createRoot = ViteReactSSG({ routes, basename: import.meta.env.BASE_URL })

docs-site/vite.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ const stripAudioComments: import('vite').Plugin = {
5050
},
5151
}
5252

53+
const BASE = '/ts-stack/'
54+
5355
export default defineConfig({
56+
base: BASE,
5457
plugins: [
5558
stripAudioComments,
5659
{
@@ -63,7 +66,7 @@ export default defineConfig({
6366
type: 'element',
6467
tagName: 'iframe',
6568
properties: {
66-
src: `/assets/asyncapi/${node.slug}/index.html`,
69+
src: `${BASE}assets/asyncapi/${node.slug}/index.html`,
6770
style: 'width: 100%; min-height: 900px; border: none; background: #011627; border-radius: 8px;',
6871
title: `AsyncAPI Specification (${node.slug})`,
6972
loading: 'lazy',

0 commit comments

Comments
 (0)