mnfst-render 0.5.17 → 0.5.18

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.
@@ -363,7 +363,7 @@ function parseYamlPaths(filePath) {
363
363
  let currentGroup = '';
364
364
  const lines = text.split(/\r?\n/);
365
365
  for (const line of lines) {
366
- const groupMatch = line.match(/^group:\s*["']?([^"'\n]+)["']?/);
366
+ const groupMatch = line.match(/^\s*-?\s*group:\s*["']?([^"'\n]+)["']?/);
367
367
  if (groupMatch) {
368
368
  currentGroup = groupMatch[1].trim().toLowerCase().replace(/\s+/g, '-');
369
369
  continue;
@@ -372,12 +372,15 @@ function parseYamlPaths(filePath) {
372
372
  if (pathMatch && currentGroup) {
373
373
  const segment = pathMatch[1].trim();
374
374
  paths.push(`${currentGroup}/${segment}`);
375
- }
376
- const genericPathMatch = line.match(/^\s*(?:-\s*)?(?:path|slug):\s*["']?([^"'\n#]+)["']?/);
377
- if (genericPathMatch) {
378
- const v = genericPathMatch[1].trim().replace(/^\/+|\/+$/g, '');
379
- if (v && !v.includes('*') && !/\.[a-z0-9]+$/i.test(v)) {
380
- paths.push(v);
375
+ } else {
376
+ // No group context — fall back to a bare path/slug. Used by data files
377
+ // whose entries are flat (e.g. articles list with `path:` per item).
378
+ const genericPathMatch = line.match(/^\s*(?:-\s*)?(?:path|slug):\s*["']?([^"'\n#]+)["']?/);
379
+ if (genericPathMatch) {
380
+ const v = genericPathMatch[1].trim().replace(/^\/+|\/+$/g, '');
381
+ if (v && !v.includes('*') && !/\.[a-z0-9]+$/i.test(v)) {
382
+ paths.push(v);
383
+ }
381
384
  }
382
385
  }
383
386
  }
@@ -1813,8 +1816,11 @@ async function runPrerender(config) {
1813
1816
  paths.add(`${locale}/${seg}`);
1814
1817
  }
1815
1818
  }
1816
- // Default locale also under its slug (e.g. /en/, /en/page-1) so linking is symmetric; canonical points to root
1817
- if (defaultLocale) {
1819
+ // Default locale also under its slug (e.g. /en/, /en/page-1) so linking is
1820
+ // symmetric with other locales; canonical points to root. Skip this when
1821
+ // there's only one locale — the duplicates serve no purpose and bloat the
1822
+ // output (every page would be written twice: at root AND under /en/).
1823
+ if (defaultLocale && locales.length > 1) {
1818
1824
  paths.add(defaultLocale);
1819
1825
  for (const seg of localeNeutralSegments) {
1820
1826
  if (seg !== '') paths.add(`${defaultLocale}/${seg}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-render",
3
- "version": "0.5.17",
3
+ "version": "0.5.18",
4
4
  "description": "Render Manifest sites to static HTML for SEO",
5
5
  "type": "module",
6
6
  "bin": {