Skip to content

Commit 6e2ce56

Browse files
committed
fix: display all versions on every other versioned file
1 parent 016c7ae commit 6e2ce56

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app/[[...path]]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ export default async function Page({params}: {params: {path?: string[]}}) {
109109
}
110110
const {mdxSource, frontMatter} = doc;
111111

112+
// collect versioned files
112113
const versions = (await getDocsFrontMatter())
113-
.filter(docc => {
114-
return docc.slug.includes('__v') && docc.slug.includes(pageNode.path);
114+
.filter(({slug}) => {
115+
return slug.includes('__v') && slug.includes(pageNode.path.split('__v')[0]);
115116
})
116117
.map(({slug}) => {
117118
const segments = slug.split('__v');

src/components/versionSelector/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function VersionSelector({versions}: {versions: string[]}) {
3434
return pathname?.split(VERSION_INDICATOR)[0];
3535
}
3636

37-
return `${stripTrailingSlash(pathname)}${VERSION_INDICATOR}${version}`;
37+
return `${stripTrailingSlash(pathname.split(VERSION_INDICATOR)[0])}${VERSION_INDICATOR}${version}`;
3838
}
3939

4040
return '';

0 commit comments

Comments
 (0)