Skip to content

Commit 9c7a569

Browse files
committed
Add docs base path
1 parent 54bff26 commit 9c7a569

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

docs/components/story-embed.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export function StoryEmbed({ storyId, height = 200, title }: StoryEmbedProps) {
3333
return () => observer.disconnect();
3434
}, []);
3535

36-
const src = `/storybook/iframe.html?id=${storyId}&viewMode=story&globals=theme:${theme}`;
36+
const basePath = process.env.DOCS_BASE_PATH || "";
37+
const src = `${basePath}/storybook/iframe.html?id=${storyId}&viewMode=story&globals=theme:${theme}`;
3738

3839
return (
3940
<iframe

docs/next.config.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ const withMDX = createMDX();
66
const cargoToml = readFileSync("../Cargo.toml", "utf-8");
77
const version = cargoToml.match(/^version\s*=\s*"(.+)"/m)?.[1] ?? "latest";
88

9+
const basePath = process.env.DOCS_BASE_PATH || "";
10+
911
/** @type {import('next').NextConfig} */
1012
const config = {
11-
env: { HADRIAN_VERSION: version },
13+
env: { HADRIAN_VERSION: version, DOCS_BASE_PATH: basePath },
1214
reactStrictMode: true,
1315
// Static export for serving from gateway
1416
output: "export",
1517
// Output to 'out' directory (default, can be served by gateway)
1618
distDir: "out",
1719
// Use trailing slashes for cleaner static URLs
1820
trailingSlash: true,
21+
...(basePath && { basePath }),
1922
};
2023

2124
export default withMDX(config);

0 commit comments

Comments
 (0)