File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ export default function SearchBar() {
2222 useEffect ( ( ) => {
2323 // Find the hero-search container and render Pagefind there
2424 const heroSearchContainer = document . getElementById ( "hero-search" ) ;
25- const basePath = getBasePath ( ) ;
25+
26+ // Detect base path from the current page URL
27+ // If we're on GitHub Pages, the path will be /implementation-catalog/...
28+ const currentPath = window . location . pathname ;
29+ const basePath = currentPath . startsWith ( '/implementation-catalog' ) ? '/implementation-catalog' : '' ;
2630
2731 if ( typeof window !== "undefined" && heroSearchContainer ) {
2832 // Load Pagefind CSS dynamically
Original file line number Diff line number Diff line change 22 * Get the base path for the application
33 * Returns '/implementation-catalog' in production (GitHub Pages)
44 * Returns '' in development
5+ *
6+ * Note: This checks for the environment variable at build time.
7+ * Next.js replaces process.env.NEXT_PUBLIC_* at build time.
58 */
69export function getBasePath ( ) : string {
7- return process . env . NEXT_PUBLIC_BASE_PATH === 'true' ? '/implementation-catalog' : '' ;
10+ // Check if we're in production mode (GitHub Pages)
11+ // The NEXT_PUBLIC_BASE_PATH env var is set during build
12+ const isProduction = process . env . NEXT_PUBLIC_BASE_PATH === 'true' ;
13+ return isProduction ? '/implementation-catalog' : '' ;
814}
915
1016/**
You can’t perform that action at this time.
0 commit comments