File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ import { formatBytes } from '~/utils/formatters'
88
99definePageMeta ({
1010 name: ' code' ,
11- alias: [' /package/code/:path(.*)*' , ' /code/:path(.*)*' ],
11+ // Both alias paths need to be (.+) so that they don't match the package page alias.
12+ alias: [' /package/code/:path(.+)' , ' /code/:path(.+)' ],
1213})
1314
1415const route = useRoute (' code' )
@@ -19,7 +20,8 @@ const route = useRoute('code')
1920// /code/nuxt/v/4.2.0/src/index.ts → packageName: "nuxt", version: "4.2.0", filePath: "src/index.ts"
2021// /code/@nuxt/kit/v/1.0.0 → packageName: "@nuxt/kit", version: "1.0.0", filePath: null
2122const parsedRoute = computed (() => {
22- const segments = route .params .path || []
23+ const path = route .params .path
24+ const segments = typeof path === ' string' ? (path as string ).split (' /' ) : path || []
2325
2426 // Find the /v/ separator for version
2527 const vIndex = segments .indexOf (' v' )
Original file line number Diff line number Diff line change @@ -5,14 +5,16 @@ import { assertValidPackageName } from '#shared/utils/npm'
55
66definePageMeta ({
77 name: ' docs' ,
8- alias: [' /package/docs/:path(.*)*' , ' /docs/:path(.*)*' ],
8+ // Both alias paths need to be (.+) so that they don't match the package page alias.
9+ alias: [' /package/docs/:path(.+)' , ' /docs/:path(.+)' ],
910})
1011
1112const route = useRoute (' docs' )
1213const router = useRouter ()
1314
1415const parsedRoute = computed (() => {
15- const segments = route .params .path || []
16+ const path = route .params .path
17+ const segments = typeof path === ' string' ? (path as string ).split (' /' ) : path || []
1618 const vIndex = segments .indexOf (' v' )
1719
1820 if (vIndex === - 1 || vIndex >= segments .length - 1 ) {
You can’t perform that action at this time.
0 commit comments