Skip to content

Commit bc27bb9

Browse files
qdrivenclaude
andcommitted
fix: add basePath for GitHub Pages deployment
The static site was deployed to /innate-executable/ but all assets referenced absolute paths like /_next/static/... which 404'd on GitHub Pages. Added: - basePath/assetPrefix in next.config.ts via NEXT_BASE_PATH env var - getBasePath() helper in tutorial-scanner for fetch() calls - NEXT_PUBLIC_BASE_PATH in GitHub Actions for client-side access - trailingSlash for clean GitHub Pages URL resolution Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0bde241 commit bc27bb9

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

.github/workflows/deploy-static.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838

3939
- name: Build static site
4040
working-directory: playground/apps/desktop
41+
env:
42+
NEXT_BASE_PATH: /innate-executable
43+
NEXT_PUBLIC_BASE_PATH: /innate-executable
4144
run: pnpm build
4245

4346
- name: Upload artifact

playground/apps/desktop/next.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { NextConfig } from "next";
22

3+
const basePath = process.env.NEXT_BASE_PATH || "";
4+
35
const nextConfig: NextConfig = {
46
output: "export",
57
distDir: "out",
@@ -10,6 +12,10 @@ const nextConfig: NextConfig = {
1012
ignoreBuildErrors: true,
1113
},
1214
transpilePackages: ["@innate/ui", "@innate/utils"],
15+
trailingSlash: true,
16+
...(basePath
17+
? { basePath, assetPrefix: basePath }
18+
: {}),
1319
};
1420

1521
export default nextConfig;

playground/apps/desktop/public/skills-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"generatedAt": "2026-05-04T03:49:20.647Z",
2+
"generatedAt": "2026-05-04T04:23:43.810Z",
33
"count": 14,
44
"skills": [
55
{

playground/apps/desktop/src/lib/tutorial-scanner.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ interface SkillsManifest {
4545
courses: CourseFile[];
4646
}
4747

48+
// ─── Base Path Helper ────────────────────────────────────
49+
50+
function getBasePath(): string {
51+
if (typeof window !== "undefined") {
52+
const base = document.querySelector("base");
53+
if (base?.getAttribute("href")) return base.getAttribute("href")!.replace(/\/$/, "");
54+
}
55+
return process.env.NEXT_PUBLIC_BASE_PATH || "";
56+
}
57+
4858
// ─── Manifest Loader ─────────────────────────────────────
4959

5060
let _cachedManifest: SkillsManifest | null = null;
@@ -53,7 +63,7 @@ async function loadManifest(): Promise<SkillsManifest> {
5363
if (_cachedManifest) return _cachedManifest;
5464

5565
try {
56-
const response = await fetch("/skills-manifest.json");
66+
const response = await fetch(`${getBasePath()}/skills-manifest.json`);
5767
if (response.ok) {
5868
const manifest: SkillsManifest = await response.json();
5969
_cachedManifest = manifest;
@@ -153,7 +163,7 @@ export async function loadSkillContent(
153163
const skill = manifest.skills.find((s) => s.slug === slug);
154164
if (skill?.localPath) {
155165
try {
156-
const response = await fetch(skill.localPath);
166+
const response = await fetch(`${getBasePath()}${skill.localPath}`);
157167
if (response.ok) {
158168
const content = await response.text();
159169
return { content, path: skill.localPath };
@@ -166,7 +176,7 @@ export async function loadSkillContent(
166176
// Fallback: try common path patterns directly
167177
for (const ext of [".mdx", ".md"]) {
168178
try {
169-
const response = await fetch(`/skills/${slug}${ext}`);
179+
const response = await fetch(`${getBasePath()}/skills/${slug}${ext}`);
170180
if (response.ok) {
171181
const content = await response.text();
172182
return { content, path: `/skills/${slug}${ext}` };

0 commit comments

Comments
 (0)