File tree Expand file tree Collapse file tree 1 file changed +3
-22
lines changed
Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Original file line number Diff line number Diff line change 1414 return ;
1515 }
1616 function buildSlugFromPath ( pathname ) {
17- if ( ! pathname || pathname === '/' ) {
18- return 'index' ;
19- }
20-
21- let route = pathname ;
22-
17+ let route = pathname || '' ;
2318 route = route . replace ( / ^ \/ + / , '' ) ;
24- if ( ! route ) {
25- return 'index' ;
26- }
27-
2819 const segments = route . split ( '/' ) . filter ( Boolean ) ;
29- if ( ! segments . length ) {
30- return 'index' ;
31- }
32-
33- if ( segments . length >= 2 && segments [ 0 ] === 'ai' ) {
34- if ( segments [ 1 ] === 'pages' || segments [ 1 ] === 'categories' ) {
35- segments . splice ( 0 , 2 ) ;
36- }
37- }
38-
3920 const slug = segments
4021 . map ( ( segment ) => segment . trim ( ) )
4122 . filter ( Boolean )
5435 }
5536
5637 function getMarkdownUrl ( slug ) {
57- const pageSlug = slug || 'index' ;
38+ const pageSlug = slug ;
5839 const host = window . location ? window . location . host : '' ;
5940 const protocol = window . location ? window . location . protocol : 'https:' ;
6041 return `${ protocol } //${ host } /ai/pages/${ pageSlug } .md` ;
528509 } else {
529510 initialize ( ) ;
530511 }
531- } ) ( ) ;
512+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments