Skip to content

Commit bdfe46b

Browse files
committed
fix: try to fix statis search
1 parent f6191f1 commit bdfe46b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

docs/components/search.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,19 @@ function initOrama() {
2424

2525
export default function DefaultSearchDialog(props: SharedProps) {
2626
const { locale } = useI18n() // (optional) for i18n
27+
// Determine API base path at build/runtime. When deployed to GitHub Pages
28+
// the site lives under a subpath (e.g. /evolution-sdk). Set
29+
// NEXT_PUBLIC_BASE_PATH=/evolution-sdk in CI so the client requests the
30+
// correct static search JSON. Falls back to empty string for local dev.
31+
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? ''
32+
const normalizedBase = basePath.endsWith('/') && basePath.length > 1 ? basePath.slice(0, -1) : basePath
33+
const apiFrom = `${normalizedBase}/api/search`
34+
2735
const { search, setSearch, query } = useDocsSearch({
2836
type: "static",
2937
initOrama,
30-
locale
38+
locale,
39+
from: apiFrom,
3140
})
3241

3342
return (

docs/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference path="./out/types/routes.d.ts" />
3+
/// <reference path="./.next/types/routes.d.ts" />
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

0 commit comments

Comments
 (0)