@djangocfg/nextjs 2.1.411 → 2.1.413

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/README.md CHANGED
@@ -27,7 +27,7 @@
27
27
  - **i18n** — full next-intl integration with routing, middleware, and components
28
28
  - **PWA** — zero-config service worker and manifest
29
29
  - **Base Next.js Config** — reusable `createBaseNextConfig()` factory for monorepos
30
- - **Sitemap** — dynamic XML sitemap with i18n hreflang support
30
+ - **Sitemap** — paginated sitemap-index backed by `django_cfg.modules.django_sitemap` (handles 2M+ URLs)
31
31
  - **Health Checks** — production-ready health monitoring endpoints
32
32
  - **Navigation** — route definitions, menu generation, and active-state helpers
33
33
  - **AI Documentation** — search DjangoCFG docs via MCP server and CLI
@@ -294,50 +294,44 @@ import { LocaleSwitcher } from '@djangocfg/nextjs/i18n/components';
294
294
 
295
295
  ### Sitemap Generation
296
296
 
297
- Generate dynamic XML sitemaps with i18n hreflang support:
297
+ Paginated sitemap-index integrated with `django_cfg.modules.django_sitemap`.
298
+ Backed by a typed JSON contract: Django streams keyset-paginated chunks,
299
+ Next.js's native `generateSitemaps()` turns each chunk into one XML file
300
+ plus an auto-generated `<sitemapindex>` at `/sitemap.xml`. Handles
301
+ catalogs up to Google's 50 000-URLs-per-file cap without materialising
302
+ data on the frontend.
298
303
 
299
304
  ```tsx
300
- // app/sitemap.xml/route.ts
301
- import { createSitemapHandler } from '@djangocfg/nextjs/sitemap';
302
- import { routing } from '@djangocfg/nextjs/i18n';
303
-
304
- export const GET = createSitemapHandler({
305
- siteUrl: 'https://example.com',
306
- // i18n support with hreflang tags
307
- i18n: {
308
- locales: routing.locales,
309
- defaultLocale: routing.defaultLocale,
310
- },
311
- staticPages: [
312
- { loc: '/', changefreq: 'daily', priority: 1.0 },
313
- { loc: '/about', changefreq: 'monthly', priority: 0.8 },
305
+ // app/sitemap.ts
306
+ import { createDjangoSitemap } from '@djangocfg/nextjs/sitemap';
307
+
308
+ const { generateSitemaps, sitemap } = createDjangoSitemap({
309
+ host: process.env.NEXT_PUBLIC_SITE_URL!,
310
+ apiUrl: process.env.NEXT_PUBLIC_API_URL, // optional — omit for static-only
311
+ staticRoutes: [
312
+ { path: '/', changeFrequency: 'daily', priority: 1.0 },
313
+ { path: '/catalog', changeFrequency: 'daily', priority: 0.9 },
314
314
  ],
315
- dynamicPages: async () => {
316
- const posts = await fetchPosts();
317
- return posts.map(post => ({
318
- loc: `/posts/${post.slug}`,
319
- lastmod: post.updatedAt,
320
- changefreq: 'weekly',
321
- priority: 0.7,
322
- }));
323
- },
324
315
  });
316
+
317
+ export { generateSitemaps, sitemap as default };
318
+ export const revalidate = 3600;
325
319
  ```
326
320
 
327
- **Generated XML with hreflang:**
321
+ ```tsx
322
+ // app/robots.ts
323
+ import { createRobots } from '@djangocfg/nextjs/sitemap';
328
324
 
329
- ```xml
330
- <url>
331
- <loc>https://example.com/en/about</loc>
332
- <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/about"/>
333
- <xhtml:link rel="alternate" hreflang="ru" href="https://example.com/ru/about"/>
334
- <xhtml:link rel="alternate" hreflang="ko" href="https://example.com/ko/about"/>
335
- <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/about"/>
336
- <changefreq>monthly</changefreq>
337
- <priority>0.8</priority>
338
- </url>
325
+ export default createRobots({
326
+ host: process.env.NEXT_PUBLIC_SITE_URL!,
327
+ disallow: ['/account/', '/auth', '/api/'],
328
+ });
339
329
  ```
340
330
 
331
+ See [`src/sitemap/README.md`](./src/sitemap/README.md) for the full
332
+ backend ↔ frontend integration guide, including the Django source
333
+ registration, cache layers, and deployment notes.
334
+
341
335
  ### Health Check Endpoint
342
336
 
343
337
  Create a health monitoring endpoint:
@@ -14,7 +14,7 @@ var require_package = __commonJS({
14
14
  "package.json"(exports, module) {
15
15
  module.exports = {
16
16
  name: "@djangocfg/nextjs",
17
- version: "2.1.411",
17
+ version: "2.1.413",
18
18
  description: "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
19
19
  keywords: [
20
20
  "nextjs",