simple-content-site 2.1.0 → 2.1.1

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.
Files changed (2) hide show
  1. package/content.config.ts +14 -3
  2. package/package.json +2 -2
package/content.config.ts CHANGED
@@ -84,10 +84,10 @@ const createFooterSchema = () => z.object({
84
84
 
85
85
  let collections: Record<string, DefinedCollection>
86
86
 
87
- if (locales && Array.isArray(locales)) {
87
+ const buildI18nCollections = () => {
88
88
  collections = {}
89
89
  for (const locale of locales) {
90
- const code = typeof locale === 'string' ? locale : locale.code
90
+ const code = (typeof locale === 'string' ? locale : locale.code).replace('-', '_')
91
91
 
92
92
  collections[`landing_${code}`] = defineCollection({
93
93
  type: 'page',
@@ -133,7 +133,8 @@ if (locales && Array.isArray(locales)) {
133
133
  })
134
134
  }
135
135
  }
136
- else {
136
+
137
+ const buildDefaultCollections = () => {
137
138
  collections = {
138
139
  landing: defineCollection({
139
140
  type: 'page',
@@ -174,4 +175,14 @@ else {
174
175
  }
175
176
  }
176
177
 
178
+ if (locales && Array.isArray(locales)) {
179
+ if (locales.length === 0) {
180
+ console.warn('Site: There are 0 locales, building with defaults instead.')
181
+ }
182
+ buildI18nCollections()
183
+ }
184
+ else {
185
+ buildDefaultCollections()
186
+ }
187
+
177
188
  export default defineContentConfig({ collections })
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.0",
4
+ "version": "2.1.1",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
7
7
  "repository": {
@@ -39,7 +39,7 @@
39
39
  "minimark": "^0.2.0",
40
40
  "motion-v": "^1.7.4",
41
41
  "nuxt-og-image": "^5.1.13",
42
- "nuxt-studio": "^1.0.0",
42
+ "nuxt-studio": "^1.1.0",
43
43
  "pkg-types": "^2.3.0",
44
44
  "scule": "^1.3.0",
45
45
  "tailwindcss": "^4.1.17",