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 @@ -80,10 +80,20 @@ function generateLinks(filepath) {
8080 // .mdファイルのみプレビューURL生成
8181 let previewUrl = null ;
8282 if ( filepath . endsWith ( '.md' ) ) {
83- const previewPath = filepath
83+ let previewPath = filepath
8484 . replace ( 'src/content/' , '' )
8585 . replace ( / \/ R E A D M E \. m d $ / , '' ) // READMEの場合はディレクトリのみ
8686 . replace ( / \. m d $ / , '' ) ;
87+
88+ // チュートリアルの特殊なパス変換
89+ if ( previewPath . startsWith ( 'tutorials/' ) ) {
90+ // tutorials/first-app/intro -> tutorials/first-app
91+ // tutorials/first-app/steps/01-hello-world -> tutorials/first-app/01-hello-world
92+ previewPath = previewPath
93+ . replace ( / \/ i n t r o $ / , '' ) // intro ディレクトリを削除
94+ . replace ( / \/ s t e p s \/ / , '/' ) ; // steps/ を削除
95+ }
96+
8797 previewUrl = `https://angular.jp/${ previewPath } ` ;
8898 }
8999
You can’t perform that action at this time.
0 commit comments