Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/components/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ function initOrama() {

export default function DefaultSearchDialog(props: SharedProps) {
const { locale } = useI18n() // (optional) for i18n
// Determine API base path at build/runtime. When deployed to GitHub Pages
// the site lives under a subpath (e.g. /evolution-sdk). Set
// NEXT_PUBLIC_BASE_PATH=/evolution-sdk in CI so the client requests the
// correct static search JSON. Falls back to empty string for local dev.
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? ''
const normalizedBase = basePath.endsWith('/') && basePath.length > 1 ? basePath.slice(0, -1) : basePath
const apiFrom = `${normalizedBase}/api/search`

const { search, setSearch, query } = useDocsSearch({
type: "static",
initOrama,
locale
locale,
from: apiFrom,
})

return (
Expand Down
2 changes: 1 addition & 1 deletion docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./out/types/routes.d.ts" />
/// <reference path="./.next/types/routes.d.ts" />

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