@koehler8/cms 1.0.0-beta.22 → 1.0.0-beta.23
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/package.json +1 -1
- package/vite-plugin.js +12 -5
package/package.json
CHANGED
package/vite-plugin.js
CHANGED
|
@@ -466,16 +466,23 @@ export default function cmsPlugin(options = {}) {
|
|
|
466
466
|
if (!siteConfig) {
|
|
467
467
|
throw new Error(`[@koehler8/cms] site config not found at ${configDir}`);
|
|
468
468
|
}
|
|
469
|
-
// Discover locales actually present on disk:
|
|
470
|
-
// content/ that
|
|
471
|
-
//
|
|
472
|
-
//
|
|
469
|
+
// Discover locales actually present on disk: any directory under
|
|
470
|
+
// content/ that has at least one of `site.json`, `shared.json`, or
|
|
471
|
+
// a `pages/` subdir is treated as a real locale. (Earlier the check
|
|
472
|
+
// required `site.json` specifically — too strict for sites that
|
|
473
|
+
// author per-locale page overrides without overriding the site
|
|
474
|
+
// metadata, which is the common pattern for translation-only locale
|
|
475
|
+
// dirs.)
|
|
476
|
+
const localeDirHasContent = (dir) =>
|
|
477
|
+
fs.existsSync(path.join(dir, 'site.json'))
|
|
478
|
+
|| fs.existsSync(path.join(dir, 'shared.json'))
|
|
479
|
+
|| fs.existsSync(path.join(dir, 'pages'));
|
|
473
480
|
availableLocales = fs.existsSync(contentDir)
|
|
474
481
|
? fs
|
|
475
482
|
.readdirSync(contentDir, { withFileTypes: true })
|
|
476
483
|
.filter((d) => d.isDirectory())
|
|
477
484
|
.map((d) => d.name)
|
|
478
|
-
.filter((name) =>
|
|
485
|
+
.filter((name) => localeDirHasContent(path.join(contentDir, name)))
|
|
479
486
|
.sort()
|
|
480
487
|
: [];
|
|
481
488
|
pagePaths = collectPagePaths(siteConfig);
|