@@ -19,20 +19,20 @@ export default defineConfig({
19
19
const repositories = JSON . parse ( fs . readFileSync ( 'repositories.json' , 'utf-8' ) ) ;
20
20
const repositoriesMap : Map < string , RepoData > = new Map ( repositories . map ( ( repoData : RepoData ) => [ repoData . repository , repoData ] ) ) ;
21
21
22
- let repoName : string ;
22
+ let repoName : string = '' ;
23
23
24
- if ( pageData . relativePath . startsWith ( 'api/' ) ) {
25
- // For API paths, repository name is in the second segment after rewrite
26
- repoName = pageData . relativePath . split ( ' /') [ 1 ] || '' ;
27
- } else {
28
- // Use filePath to determine if this is autumn documentation
29
- // pageData.filePath contains the original path before rewrites
30
- if ( pageData . filePath && pageData . filePath . includes ( 'products/000-autumn' ) ) {
31
- // This is autumn documentation at root level (after rewrite from products/000-autumn/)
32
- repoName = ' autumn' ;
33
- } else {
34
- // For other products, repository name is in the first segment after rewrite
35
- repoName = pageData . relativePath . split ( '/' ) [ 0 ] || '' ;
24
+ // Use filePath for all variants to extract repository name
25
+ if ( pageData . filePath ) {
26
+ if ( pageData . filePath . startsWith ( 'api /') ) {
27
+ // For API paths: api/000-autumn/... or api/003-extends/...
28
+ const pathSegments = pageData . filePath . split ( '/' ) ;
29
+ const repoSegment = pathSegments [ 1 ] || '' ;
30
+ repoName = repoSegment . replace ( / ^ \d + - / , '' ) ; // Remove number prefix
31
+ } else if ( pageData . filePath . startsWith ( ' products/' ) ) {
32
+ // For product paths: products/000- autumn/... or products/003-extends/...
33
+ const pathSegments = pageData . filePath . split ( '/' ) ;
34
+ const repoSegment = pathSegments [ 1 ] || '' ;
35
+ repoName = repoSegment . replace ( / ^ \d + - / , '' ) ; // Remove number prefix
36
36
}
37
37
}
38
38
@@ -184,8 +184,8 @@ export default defineConfig({
184
184
return `https://github.com/${ organization } /${ repository } /edit/master/docs/api/${ restPath } ` ;
185
185
}
186
186
187
- // For product pages - use filePath to determine if it's autumn docs
188
- if ( pageData . filePath && pageData . filePath . includes ( 'products/000- autumn') ) {
187
+ // For product pages - determine path based on repository type
188
+ if ( repository === ' autumn') {
189
189
// This is autumn documentation at root level - use entire relativePath
190
190
const restPath = relativePath
191
191
return `https://github.com/${ organization } /${ repository } /edit/master/docs/product/${ restPath } ` ;
0 commit comments