@cmssy/next 0.5.0 → 0.5.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.
- package/dist/index.cjs +11 -3
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -288,9 +288,14 @@ function createCmssyRobots(config, options = {}) {
|
|
|
288
288
|
};
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
+
var DEFAULT_EXCLUDED_SLUGS = ["/not-found", "/404"];
|
|
292
|
+
function normalizeSlug(slug) {
|
|
293
|
+
if (slug === "/" || slug === "") return "/";
|
|
294
|
+
return slug.startsWith("/") ? slug : `/${slug}`;
|
|
295
|
+
}
|
|
291
296
|
function localizedPath(slug, locale, defaultLocale) {
|
|
292
|
-
const
|
|
293
|
-
return locale === defaultLocale ?
|
|
297
|
+
const normalized = slug === "/" ? "" : slug;
|
|
298
|
+
return locale === defaultLocale ? normalized || "/" : `/${locale}${normalized}`;
|
|
294
299
|
}
|
|
295
300
|
function createCmssySitemap(config, options = {}) {
|
|
296
301
|
const clientConfig = {
|
|
@@ -310,7 +315,10 @@ function createCmssySitemap(config, options = {}) {
|
|
|
310
315
|
const baseUrl = await resolveSeoBaseUrl(config, options.baseUrl);
|
|
311
316
|
const defaultLocale = config.defaultLocale ?? "en";
|
|
312
317
|
const locales = config.enabledLocales && config.enabledLocales.length > 0 ? config.enabledLocales : [defaultLocale];
|
|
313
|
-
const
|
|
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) => {
|
|
314
322
|
const lastModified = page.updatedAt ?? page.publishedAt ?? void 0;
|
|
315
323
|
const entry = {
|
|
316
324
|
url: `${baseUrl}${localizedPath(page.slug, defaultLocale, defaultLocale)}`,
|
package/dist/index.d.cts
CHANGED
|
@@ -92,6 +92,11 @@ declare function createCmssyRobots(config: CmssyNextConfig, options?: CreateCmss
|
|
|
92
92
|
interface CreateCmssySitemapOptions extends SeoBaseUrlOption {
|
|
93
93
|
/** Extra static entries appended to the generated page list. */
|
|
94
94
|
extra?: MetadataRoute.Sitemap;
|
|
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.
|
|
98
|
+
*/
|
|
99
|
+
excludeSlugs?: string[];
|
|
95
100
|
}
|
|
96
101
|
/**
|
|
97
102
|
* Builds the default export for Next's `app/sitemap.ts` from the workspace's
|
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,11 @@ declare function createCmssyRobots(config: CmssyNextConfig, options?: CreateCmss
|
|
|
92
92
|
interface CreateCmssySitemapOptions extends SeoBaseUrlOption {
|
|
93
93
|
/** Extra static entries appended to the generated page list. */
|
|
94
94
|
extra?: MetadataRoute.Sitemap;
|
|
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.
|
|
98
|
+
*/
|
|
99
|
+
excludeSlugs?: string[];
|
|
95
100
|
}
|
|
96
101
|
/**
|
|
97
102
|
* Builds the default export for Next's `app/sitemap.ts` from the workspace's
|
package/dist/index.js
CHANGED
|
@@ -286,9 +286,14 @@ function createCmssyRobots(config, options = {}) {
|
|
|
286
286
|
};
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
+
var DEFAULT_EXCLUDED_SLUGS = ["/not-found", "/404"];
|
|
290
|
+
function normalizeSlug(slug) {
|
|
291
|
+
if (slug === "/" || slug === "") return "/";
|
|
292
|
+
return slug.startsWith("/") ? slug : `/${slug}`;
|
|
293
|
+
}
|
|
289
294
|
function localizedPath(slug, locale, defaultLocale) {
|
|
290
|
-
const
|
|
291
|
-
return locale === defaultLocale ?
|
|
295
|
+
const normalized = slug === "/" ? "" : slug;
|
|
296
|
+
return locale === defaultLocale ? normalized || "/" : `/${locale}${normalized}`;
|
|
292
297
|
}
|
|
293
298
|
function createCmssySitemap(config, options = {}) {
|
|
294
299
|
const clientConfig = {
|
|
@@ -308,7 +313,10 @@ function createCmssySitemap(config, options = {}) {
|
|
|
308
313
|
const baseUrl = await resolveSeoBaseUrl(config, options.baseUrl);
|
|
309
314
|
const defaultLocale = config.defaultLocale ?? "en";
|
|
310
315
|
const locales = config.enabledLocales && config.enabledLocales.length > 0 ? config.enabledLocales : [defaultLocale];
|
|
311
|
-
const
|
|
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) => {
|
|
312
320
|
const lastModified = page.updatedAt ?? page.publishedAt ?? void 0;
|
|
313
321
|
const entry = {
|
|
314
322
|
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.
|
|
3
|
+
"version": "0.5.1",
|
|
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.
|
|
44
|
+
"@cmssy/react": "^0.5.1",
|
|
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.
|
|
57
|
+
"@cmssy/react": "0.5.1"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"jose": "^6.2.3"
|