@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 +30 -36
- package/dist/config/index.mjs +1 -1
- package/dist/config/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +110 -137
- package/dist/index.mjs.map +1 -1
- package/dist/sitemap/index.d.mts +126 -56
- package/dist/sitemap/index.mjs +107 -134
- package/dist/sitemap/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/sitemap/README.md +315 -0
- package/src/sitemap/fetch.ts +66 -0
- package/src/sitemap/ids.ts +21 -0
- package/src/sitemap/index.ts +22 -4
- package/src/sitemap/robots.ts +34 -0
- package/src/sitemap/sitemap.ts +94 -0
- package/src/sitemap/types.ts +67 -17
- package/src/sitemap/generator.ts +0 -144
- package/src/sitemap/route.ts +0 -146
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** —
|
|
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
|
-
|
|
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.
|
|
301
|
-
import {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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
|
-
|
|
321
|
+
```tsx
|
|
322
|
+
// app/robots.ts
|
|
323
|
+
import { createRobots } from '@djangocfg/nextjs/sitemap';
|
|
328
324
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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:
|
package/dist/config/index.mjs
CHANGED
|
@@ -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.
|
|
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",
|