Skip to content

Commit 2a30b04

Browse files
committed
fix: Add basePath to API reference links
Apply BASE_PATH prefix to API package links in sidebar and index page for GitHub Pages compatibility.
1 parent 7933a34 commit 2a30b04

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

templates/api/ApiPage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ function PackageGroupSection({ group }: PackageGroupSectionProps) {
7474
</h2>
7575
<div class="package-grid">
7676
{group.packages.map((pkg) => (
77-
<a key={pkg.name} href={`/api/${pkg.name}`} class="package-card">
77+
<a
78+
key={pkg.name}
79+
href={`${basePath}/api/${pkg.name}/`}
80+
class="package-card"
81+
>
7882
<h3>{pkg.specifier}</h3>
7983
<div class="package-meta">
8084
<span class="package-version">v{pkg.version}</span>

templates/api/components.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
extractTypeParamRefs,
3838
extractTypeRefs,
3939
} from "../../lib/type-references.ts";
40+
import { basePath } from "../../data/docs.ts";
4041

4142
// ============================================================================
4243
// Type Display Components (with linking)
@@ -232,7 +233,7 @@ function renderTypeName(name: string, ctx: TypeLinkContext): Child {
232233
if (targetPackage !== currentPackage) {
233234
return (
234235
<a
235-
href={`/api/${targetPackage}#${name}`}
236+
href={`${basePath}/api/${targetPackage}/#${name}`}
236237
class="type-link type-link-cross-package"
237238
>
238239
{name}
@@ -1225,7 +1226,7 @@ export function PackageSidebar(
12251226
key={pkg.name}
12261227
class={pkg.name === currentPackage ? "active" : ""}
12271228
>
1228-
<a href={`/api/${pkg.name}`}>{pkg.name}</a>
1229+
<a href={`${basePath}/api/${pkg.name}/`}>{pkg.name}</a>
12291230
</li>
12301231
))}
12311232
</ul>

0 commit comments

Comments
 (0)