File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,17 @@ export default function Projects() {
1313 > ( "all" ) ;
1414
1515 // Fetch projects from JSON file
16- const basePath = process . env . NEXT_PUBLIC_BASE_PATH || "" ;
16+ // Use basePath from next.config.js if available, fallback to ''
17+ let basePath = "" ;
18+ if ( typeof window !== "undefined" ) {
19+ // Try to get from <base> tag (set by Next.js for static export)
20+ const baseEl = document . querySelector ( "base" ) ;
21+ if ( baseEl && baseEl . getAttribute ( "href" ) ) {
22+ basePath = baseEl . getAttribute ( "href" ) ?. replace ( / \/ $ / , "" ) || "" ;
23+ }
24+ } else if ( process . env . NEXT_PUBLIC_BASE_PATH ) {
25+ basePath = process . env . NEXT_PUBLIC_BASE_PATH ;
26+ }
1727 const { data : projects = [ ] , isLoading } = useQuery ( {
1828 queryKey : [ "projects" ] ,
1929 queryFn : async ( ) : Promise < Project [ ] > => {
You can’t perform that action at this time.
0 commit comments