diff --git a/docs-site/components/docs/DocsSearch.tsx b/docs-site/components/docs/DocsSearch.tsx
index ccad24674..3f9df3755 100644
--- a/docs-site/components/docs/DocsSearch.tsx
+++ b/docs-site/components/docs/DocsSearch.tsx
@@ -12,6 +12,7 @@ import {
CommandList,
} from "@/components/ui/command";
import { create, load, search, type AnyOrama } from "@orama/orama";
+import { withBasePath } from "@/lib/basePath";
interface SearchResult {
title: string;
@@ -44,7 +45,7 @@ export function DocsSearch({ resolve }: { resolve: (path: string) => string }) {
useEffect(() => {
if (!open || dbRef.current) return;
setLoading(true);
- fetch("/search-index.json")
+ fetch(withBasePath("/search-index.json"))
.then((res) => res.json())
.then((data) => {
const db = create({
diff --git a/docs-site/components/docs/DocsShell.tsx b/docs-site/components/docs/DocsShell.tsx
index 94bee411d..44d0f2f2f 100644
--- a/docs-site/components/docs/DocsShell.tsx
+++ b/docs-site/components/docs/DocsShell.tsx
@@ -8,6 +8,7 @@ import { type NavGroup, type NavItem, type NavTab } from "@/config/docsNav";
import { TableOfContents } from "./TableOfContents";
import { DocsSearch } from "./DocsSearch";
import { resolveHref } from "@/lib/resolveHref";
+import { withBasePath } from "@/lib/basePath";
import type { Heading } from "@/lib/docs";
/* ------------------------------------------------------------------ */
@@ -235,7 +236,7 @@ export function DocsShell({
>
@@ -245,7 +246,7 @@ export function DocsShell({
diff --git a/docs-site/components/docs/mdx/index.tsx b/docs-site/components/docs/mdx/index.tsx
index 9f13d40b7..79a128eca 100644
--- a/docs-site/components/docs/mdx/index.tsx
+++ b/docs-site/components/docs/mdx/index.tsx
@@ -10,6 +10,7 @@ import { OSAutoDetect } from "./OSAutoDetect";
import { CodeBlock } from "./CodeBlock";
import { CodeGroup } from "./CodeGroup";
import { MdxLink } from "./MdxLink";
+import { withBasePath } from "@/lib/basePath";
export const mdxComponents: MDXComponents = {
// Mintlify callout variants
@@ -62,9 +63,13 @@ export const mdxComponents: MDXComponents = {
// Rewrite image paths — images are copied to public/images/docs/ at build time
img: ({ src, alt, ...props }: any) => {
- if (src && src.startsWith("/images/")) {
+ if (src && src.startsWith("/images/") && !src.startsWith("/images/docs/")) {
src = `/images/docs${src.slice("/images".length)}`;
}
+ // Prefix the deploy base path for raw absolute asset paths (GitHub Pages).
+ if (src && src.startsWith("/")) {
+ src = withBasePath(src);
+ }
return