@@ -18,7 +18,10 @@ export default defineConfig(({ mode }) => {
1818
1919 // Read config.js to get courseName and doAuth
2020 let courseName = 'Data Structures and Algorithms' ; // fallback
21- let courseUrl = 'data-structures-and-algorithms' ; // fallback
21+
22+ let baseUrl = env . BASE_URL ? env . BASE_URL : 'data-structures-and-algorithms' ;
23+ console . log ( "baseUrl: " , baseUrl ) ;
24+
2225 let doAuth = false ; // fallback
2326 try {
2427 const configPath = path . resolve ( process . cwd ( ) , 'src/config.js' ) ;
@@ -28,7 +31,7 @@ export default defineConfig(({ mode }) => {
2831 if ( courseNameMatch ) {
2932 courseName = courseNameMatch [ 1 ] ;
3033 // Transform courseName to URL-friendly format
31- courseUrl = courseName . toLowerCase ( ) . replace ( / \s + / g , '-' ) . replace ( / [ ^ a - z 0 - 9 - ] / g , '' ) ;
34+
3235 }
3336
3437 const doAuthMatch = configContent . match ( / d o A u t h : \s * ( t r u e | f a l s e ) / ) ;
@@ -49,7 +52,7 @@ export default defineConfig(({ mode }) => {
4952 transformIndexHtml ( html ) {
5053 return html
5154 . replace ( / % C O U R S E _ N A M E % / g, courseName )
52- . replace ( / % C O U R S E _ U R L % / g, courseUrl ) ;
55+ . replace ( / % C O U R S E _ U R L % / g, baseUrl ) ;
5356 }
5457 } ;
5558
@@ -88,7 +91,7 @@ export default defineConfig(({ mode }) => {
8891 }
8992
9093 return {
91- base : `/${ courseUrl } /` ,
94+ base : `/${ baseUrl } /` ,
9295 plugins,
9396 // Make env variables available to client-side code
9497 ...( doAuth && {
0 commit comments