Skip to content

Commit 311171c

Browse files
Copilotnixel2007
andcommitted
Remove hardcoded autumn directories, use pageData.filePath instead
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
1 parent 857e1cc commit 311171c

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

.vitepress/config.mts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ export default defineConfig({
2525
// For API paths, repository name is in the second segment after rewrite
2626
repoName = pageData.relativePath.split('/')[1]?.replace(/\d+-/g, '') || '';
2727
} else {
28-
// Check if this is a root-level autumn path (after rewrite from products/autumn/)
29-
const firstSegment = pageData.relativePath.split('/')[0];
30-
const autumnRootDirs = ['getting-started', 'framework-elements'];
31-
32-
if (autumnRootDirs.includes(firstSegment)) {
33-
// This is autumn documentation at root level
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/)
3432
repoName = 'autumn';
3533
} else {
3634
// For other products, repository name is in the first segment after rewrite
35+
const firstSegment = pageData.relativePath.split('/')[0];
3736
repoName = firstSegment?.replace(/\d+-/g, '') || '';
3837
}
3938
}
@@ -186,11 +185,8 @@ export default defineConfig({
186185
return `https://github.com/${organization}/${repository}/edit/master/docs/api/${restPath}`;
187186
}
188187

189-
// For product pages
190-
const firstSegment = relativePath.split('/')[0];
191-
const autumnRootDirs = ['getting-started', 'framework-elements'];
192-
193-
if (autumnRootDirs.includes(firstSegment)) {
188+
// For product pages - use filePath to determine if it's autumn docs
189+
if (pageData.filePath && pageData.filePath.includes('products/000-autumn')) {
194190
// This is autumn documentation at root level - path after first segment
195191
const [_, ...rest] = relativePath.split('/')
196192
const restPath = rest.join('/')

0 commit comments

Comments
 (0)