docus 4.1.0 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/app.vue +10 -8
- package/app/error.vue +10 -8
- package/modules/routing.ts +9 -4
- package/package.json +1 -1
package/app/app.vue
CHANGED
|
@@ -31,14 +31,16 @@ useSeoMeta({
|
|
|
31
31
|
twitterCard: 'summary_large_image',
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
34
|
+
if (isEnabled.value) {
|
|
35
|
+
const route = useRoute()
|
|
36
|
+
const defaultLocale = useRuntimeConfig().public.i18n.defaultLocale
|
|
37
|
+
onMounted(() => {
|
|
38
|
+
const currentLocale = route.path.split('/')[1]
|
|
39
|
+
if (!locales.some(locale => locale.code === currentLocale)) {
|
|
40
|
+
return navigateTo(switchLocalePath(defaultLocale) as string)
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
42
44
|
|
|
43
45
|
const { data: navigation } = await useAsyncData(`navigation_${collectionName.value}`, () => queryCollectionNavigation(collectionName.value as keyof PageCollections), {
|
|
44
46
|
transform: (data) => {
|
package/app/error.vue
CHANGED
|
@@ -30,14 +30,16 @@ useSeoMeta({
|
|
|
30
30
|
description: () => t('common.error.description'),
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
33
|
+
if (isEnabled.value) {
|
|
34
|
+
const route = useRoute()
|
|
35
|
+
const defaultLocale = useRuntimeConfig().public.i18n.defaultLocale
|
|
36
|
+
onMounted(() => {
|
|
37
|
+
const currentLocale = route.path.split('/')[1]
|
|
38
|
+
if (!locales.some(locale => locale.code === currentLocale)) {
|
|
39
|
+
return navigateTo(switchLocalePath(defaultLocale) as string)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
41
43
|
|
|
42
44
|
const collectionName = computed(() => isEnabled.value ? `docs_${locale.value}` : 'docs')
|
|
43
45
|
|
package/modules/routing.ts
CHANGED
|
@@ -9,10 +9,15 @@ export default defineNuxtModule({
|
|
|
9
9
|
|
|
10
10
|
const isI18nEnabled = !!(nuxt.options.i18n && nuxt.options.i18n.locales)
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
// Ensure useDocusI18n is available in the app
|
|
13
|
+
nuxt.hook('imports:extend', (imports) => {
|
|
14
|
+
if (imports.some(i => i.name === 'useDocusI18n')) return
|
|
15
|
+
|
|
16
|
+
imports.push({
|
|
17
|
+
name: 'useDocusI18n',
|
|
18
|
+
from: resolve('../app/composables/useDocusI18n'),
|
|
19
|
+
})
|
|
20
|
+
})
|
|
16
21
|
|
|
17
22
|
extendPages((pages) => {
|
|
18
23
|
const landingTemplate = resolve('../app/templates/landing.vue')
|