simple-content-site 2.1.1 → 2.2.0
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/modules/routing.ts
CHANGED
|
@@ -11,12 +11,18 @@ export default defineNuxtModule({
|
|
|
11
11
|
|
|
12
12
|
// Ensure useSiteI18n is available in the app
|
|
13
13
|
nuxt.hook('imports:extend', (imports) => {
|
|
14
|
-
|
|
14
|
+
const loadComposableIfNotFound = (composableName: string) => {
|
|
15
|
+
if (imports.some(i => i.name === composableName)) return
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
imports.push({
|
|
18
|
+
name: composableName,
|
|
19
|
+
from: resolve(`../app/composables/${composableName}`),
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
loadComposableIfNotFound('useSiteI18n')
|
|
24
|
+
loadComposableIfNotFound('useSiteHeader')
|
|
25
|
+
loadComposableIfNotFound('useSiteFooter')
|
|
20
26
|
})
|
|
21
27
|
|
|
22
28
|
// might want to know about this stuff.
|
|
@@ -27,6 +33,10 @@ export default defineNuxtModule({
|
|
|
27
33
|
extendPages((pages) => {
|
|
28
34
|
const landingTemplate = resolve('../app/templates/landing.vue')
|
|
29
35
|
|
|
36
|
+
if (pages.some(p => p.name === (isI18nEnabled ? 'lang-index' : 'index'))) {
|
|
37
|
+
if (import.meta.dev) console.warn('[Site] Duplicate landing page detected - skipping')
|
|
38
|
+
return
|
|
39
|
+
}
|
|
30
40
|
if (isI18nEnabled) {
|
|
31
41
|
pages.push({
|
|
32
42
|
name: 'lang-index',
|