@cmssy/next 0.5.1 → 0.5.2

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/dist/index.cjs CHANGED
@@ -288,7 +288,6 @@ function createCmssyRobots(config, options = {}) {
288
288
  };
289
289
  };
290
290
  }
291
- var DEFAULT_EXCLUDED_SLUGS = ["/not-found", "/404"];
292
291
  function normalizeSlug(slug) {
293
292
  if (slug === "/" || slug === "") return "/";
294
293
  return slug.startsWith("/") ? slug : `/${slug}`;
@@ -312,13 +311,17 @@ function createCmssySitemap(config, options = {}) {
312
311
  }
313
312
  pages = [];
314
313
  }
314
+ let notFoundPageId = null;
315
+ try {
316
+ notFoundPageId = (await react.fetchSiteConfig(clientConfig))?.notFoundPageId ?? null;
317
+ } catch {
318
+ notFoundPageId = null;
319
+ }
315
320
  const baseUrl = await resolveSeoBaseUrl(config, options.baseUrl);
316
321
  const defaultLocale = config.defaultLocale ?? "en";
317
322
  const locales = config.enabledLocales && config.enabledLocales.length > 0 ? config.enabledLocales : [defaultLocale];
318
- const excluded = new Set(
319
- (options.excludeSlugs ?? DEFAULT_EXCLUDED_SLUGS).map(normalizeSlug)
320
- );
321
- const entries = pages.map((page) => ({ ...page, slug: normalizeSlug(page.slug) })).filter((page) => !excluded.has(page.slug)).map((page) => {
323
+ const excluded = new Set((options.excludeSlugs ?? []).map(normalizeSlug));
324
+ const entries = pages.map((page) => ({ ...page, slug: normalizeSlug(page.slug) })).filter((page) => page.id !== notFoundPageId && !excluded.has(page.slug)).map((page) => {
322
325
  const lastModified = page.updatedAt ?? page.publishedAt ?? void 0;
323
326
  const entry = {
324
327
  url: `${baseUrl}${localizedPath(page.slug, defaultLocale, defaultLocale)}`,
package/dist/index.d.cts CHANGED
@@ -93,8 +93,9 @@ interface CreateCmssySitemapOptions extends SeoBaseUrlOption {
93
93
  /** Extra static entries appended to the generated page list. */
94
94
  extra?: MetadataRoute.Sitemap;
95
95
  /**
96
- * Page slugs to omit (e.g. the 404 content page). Defaults to the reserved
97
- * not-found slugs so a published 404 page is never advertised as indexable.
96
+ * Additional page slugs to omit. The workspace's configured 404 page
97
+ * (Settings 404 page) is excluded automatically via its id, so this is
98
+ * only for extra slugs you never want indexed.
98
99
  */
99
100
  excludeSlugs?: string[];
100
101
  }
package/dist/index.d.ts CHANGED
@@ -93,8 +93,9 @@ interface CreateCmssySitemapOptions extends SeoBaseUrlOption {
93
93
  /** Extra static entries appended to the generated page list. */
94
94
  extra?: MetadataRoute.Sitemap;
95
95
  /**
96
- * Page slugs to omit (e.g. the 404 content page). Defaults to the reserved
97
- * not-found slugs so a published 404 page is never advertised as indexable.
96
+ * Additional page slugs to omit. The workspace's configured 404 page
97
+ * (Settings 404 page) is excluded automatically via its id, so this is
98
+ * only for extra slugs you never want indexed.
98
99
  */
99
100
  excludeSlugs?: string[];
100
101
  }
package/dist/index.js CHANGED
@@ -286,7 +286,6 @@ function createCmssyRobots(config, options = {}) {
286
286
  };
287
287
  };
288
288
  }
289
- var DEFAULT_EXCLUDED_SLUGS = ["/not-found", "/404"];
290
289
  function normalizeSlug(slug) {
291
290
  if (slug === "/" || slug === "") return "/";
292
291
  return slug.startsWith("/") ? slug : `/${slug}`;
@@ -310,13 +309,17 @@ function createCmssySitemap(config, options = {}) {
310
309
  }
311
310
  pages = [];
312
311
  }
312
+ let notFoundPageId = null;
313
+ try {
314
+ notFoundPageId = (await fetchSiteConfig(clientConfig))?.notFoundPageId ?? null;
315
+ } catch {
316
+ notFoundPageId = null;
317
+ }
313
318
  const baseUrl = await resolveSeoBaseUrl(config, options.baseUrl);
314
319
  const defaultLocale = config.defaultLocale ?? "en";
315
320
  const locales = config.enabledLocales && config.enabledLocales.length > 0 ? config.enabledLocales : [defaultLocale];
316
- const excluded = new Set(
317
- (options.excludeSlugs ?? DEFAULT_EXCLUDED_SLUGS).map(normalizeSlug)
318
- );
319
- const entries = pages.map((page) => ({ ...page, slug: normalizeSlug(page.slug) })).filter((page) => !excluded.has(page.slug)).map((page) => {
321
+ const excluded = new Set((options.excludeSlugs ?? []).map(normalizeSlug));
322
+ const entries = pages.map((page) => ({ ...page, slug: normalizeSlug(page.slug) })).filter((page) => page.id !== notFoundPageId && !excluded.has(page.slug)).map((page) => {
320
323
  const lastModified = page.updatedAt ?? page.publishedAt ?? void 0;
321
324
  const entry = {
322
325
  url: `${baseUrl}${localizedPath(page.slug, defaultLocale, defaultLocale)}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/next",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -41,7 +41,7 @@
41
41
  "dist"
42
42
  ],
43
43
  "peerDependencies": {
44
- "@cmssy/react": "^0.5.1",
44
+ "@cmssy/react": "^0.5.2",
45
45
  "next": ">=15",
46
46
  "react": "^18.2.0 || ^19.0.0",
47
47
  "react-dom": "^18.2.0 || ^19.0.0"
@@ -54,7 +54,7 @@
54
54
  "tsup": "^8.3.0",
55
55
  "typescript": "^5.6.0",
56
56
  "vitest": "^2.1.0",
57
- "@cmssy/react": "0.5.1"
57
+ "@cmssy/react": "0.5.2"
58
58
  },
59
59
  "dependencies": {
60
60
  "jose": "^6.2.3"