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.
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useSiteFooter } from '../../composables/useSiteFooter'
2
+ import { useSiteFooter } from '#imports'
3
3
 
4
4
  const { data: footer } = await useSiteFooter()
5
5
  </script>
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useSiteI18n } from '../../composables/useSiteI18n'
3
- import { useSiteHeader } from '../../composables/useSiteHeader'
2
+ import { useSiteHeader, useSiteI18n } from '#imports'
4
3
 
5
4
  const { data: header } = await useSiteHeader()
6
5
 
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { ContentNavigationItem } from '@nuxt/content'
3
- import { useSiteHeader } from '../../composables/useSiteHeader'
3
+ import { useSiteHeader } from '#imports'
4
4
 
5
5
  const { data: header } = await useSiteHeader()
6
6
 
@@ -1,5 +1,5 @@
1
1
  import type { Collections, FooterCollectionItem } from '@nuxt/content'
2
- import { useSiteI18n } from './useSiteI18n'
2
+ import { useSiteI18n } from '#imports'
3
3
 
4
4
  export const useSiteFooter = () => {
5
5
  const { locale, isEnabled, defaultLocale } = useSiteI18n()
@@ -1,5 +1,5 @@
1
1
  import type { Collections, HeaderCollectionItem } from '@nuxt/content'
2
- import { useSiteI18n } from './useSiteI18n'
2
+ import { useSiteI18n } from '#imports'
3
3
 
4
4
  export const useSiteHeader = () => {
5
5
  const config = useAppConfig()
@@ -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
- if (imports.some(i => i.name === 'useSiteI18n')) return
14
+ const loadComposableIfNotFound = (composableName: string) => {
15
+ if (imports.some(i => i.name === composableName)) return
15
16
 
16
- imports.push({
17
- name: 'useSiteI18n',
18
- from: resolve('../app/composables/useSiteI18n'),
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',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "simple-content-site",
3
3
  "description": "Nuxt layer for simple website with basic functions.",
4
- "version": "2.1.1",
4
+ "version": "2.2.0",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
7
7
  "repository": {