File tree Expand file tree Collapse file tree 4 files changed +38
-18
lines changed Expand file tree Collapse file tree 4 files changed +38
-18
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ const nextConfig = {
99 hostname : '**' , // Adjust this for production
1010 } ,
1111 ] ,
12+ unoptimized : true , // Required for static export
1213 } ,
13- output : 'standalone' ,
14- // Helps with consistent routing
14+ output : 'export' ,
15+ basePath : '/golangmastery.github.io' ,
16+ assetPrefix : '/golangmastery.github.io/' ,
1517 trailingSlash : true ,
1618
1719 // Disable typescript checking temporarily
@@ -24,20 +26,6 @@ const nextConfig = {
2426 serverComponentsExternalPackages : [ '@prisma/client' , 'bcryptjs' ] ,
2527 } ,
2628
27- // Use rewrites for backward compatibility
28- async rewrites ( ) {
29- return [
30- {
31- source : '/courses/quick-start-with-golang' ,
32- destination : '/courses/quick-start-with-golang-modules' ,
33- } ,
34- {
35- source : '/courses/quick-start-with-golang/:slug*' ,
36- destination : '/courses/quick-start-with-golang-modules/:slug*' ,
37- }
38- ] ;
39- } ,
40-
4129 webpack : ( config ) => {
4230 config . resolve . fallback = { fs : false } ;
4331 return config ;
Original file line number Diff line number Diff line change 66 "scripts" : {
77 "dev" : " next dev" ,
88 "build" : " next build" ,
9- "export" : " next export" ,
109 "start" : " next start" ,
1110 "lint" : " next lint" ,
1211 "analyze" : " cross-env ANALYZE=true next build" ,
13- "analyze-bundle" : " node analyze-bundle.js"
12+ "analyze-bundle" : " node analyze-bundle.js" ,
13+ "deploy" : " rm -rf out && next build && touch out/.nojekyll && git add out/ && git commit -m \" Deploy to GitHub Pages\" && git subtree push --prefix out origin gh-pages"
1414 },
1515 "repository" : {
1616 "type" : " git" ,
Original file line number Diff line number Diff line change 1+ import { useEffect } from 'react' ;
2+ import { useRouter } from 'next/router' ;
3+
4+ export default function Custom404 ( ) {
5+ const router = useRouter ( ) ;
6+
7+ useEffect ( ( ) => {
8+ // Get the current path
9+ const path = window . location . pathname ;
10+
11+ // If the path includes the GitHub Pages prefix, clean it and redirect
12+ if ( path . includes ( '/golangmastery.github.io/' ) ) {
13+ const cleanPath = path . replace ( '/golangmastery.github.io' , '' ) ;
14+ router . push ( cleanPath ) ;
15+ }
16+ } , [ router ] ) ;
17+
18+ return (
19+ < div className = "min-h-screen flex items-center justify-center bg-gray-50" >
20+ < div className = "text-center" >
21+ < h1 className = "text-4xl font-bold text-gray-900 mb-4" > 404 - Page Not Found</ h1 >
22+ < p className = "text-gray-600 mb-8" > The page you're looking for doesn't exist or has been moved.</ p >
23+ < button
24+ onClick = { ( ) => router . push ( '/' ) }
25+ className = "px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors"
26+ >
27+ Go Home
28+ </ button >
29+ </ div >
30+ </ div >
31+ ) ;
32+ }
You can’t perform that action at this time.
0 commit comments