@djangocfg/nextjs 2.1.537 → 2.1.540
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 +22 -24
- package/dist/i18n/routing.d.mts +2 -2
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
## Features
|
|
25
25
|
|
|
26
|
-
- **Page Metadata + OG Images** — one factory for complete page metadata
|
|
26
|
+
- **Page Metadata + OG Images** — one factory for complete page metadata: titles, canonical + hreflang, OpenGraph, Twitter, icons (`@djangocfg/nextjs/og-image`)
|
|
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
|
|
@@ -391,8 +391,7 @@ export const GET = createHealthHandler({
|
|
|
391
391
|
|
|
392
392
|
One factory per app builds complete page `Metadata` (title, openGraph, twitter,
|
|
393
393
|
canonical + hreflang, icons). The OG image is chosen by a single `og` field —
|
|
394
|
-
static brand image by default,
|
|
395
|
-
Runtime, no `@vercel/og`:
|
|
394
|
+
the static brand image by default, or an exact URL:
|
|
396
395
|
|
|
397
396
|
```tsx
|
|
398
397
|
// app/_core/metadata.ts — bind once
|
|
@@ -407,11 +406,13 @@ export const createMetadata = makeMetadataFactory({
|
|
|
407
406
|
|
|
408
407
|
// landing page → static brand image (default)
|
|
409
408
|
export const metadata = createMetadata({ title: 'Pricing', path: '/pricing' })
|
|
410
|
-
// content page
|
|
411
|
-
export const metadata = createMetadata({ title:
|
|
409
|
+
// content page with its own image
|
|
410
|
+
export const metadata = createMetadata({ title: p.name, path, og: { image: p.image } })
|
|
412
411
|
```
|
|
413
412
|
|
|
414
|
-
|
|
413
|
+
For a card rendered per page, add an `opengraph-image` route — Next.js finds it
|
|
414
|
+
by filename and its output overrides whatever the factory set, so the factory
|
|
415
|
+
has no "dynamic" case of its own.
|
|
415
416
|
|
|
416
417
|
### Navigation Utilities
|
|
417
418
|
|
|
@@ -461,7 +462,7 @@ import { RedirectPage } from '@djangocfg/layouts/components/RedirectPage';
|
|
|
461
462
|
| `@djangocfg/nextjs/pwa/worker` | Service worker creation helpers |
|
|
462
463
|
| `@djangocfg/nextjs/sitemap` | Sitemap generation with i18n hreflang support |
|
|
463
464
|
| `@djangocfg/nextjs/health` | Health check handlers |
|
|
464
|
-
| `@djangocfg/nextjs/og-image` | Page metadata factory
|
|
465
|
+
| `@djangocfg/nextjs/og-image` | Page metadata factory — titles, canonical + hreflang, OpenGraph, Twitter, icons |
|
|
465
466
|
| `@djangocfg/nextjs/navigation` | Route definitions, menu generation, navigation helpers |
|
|
466
467
|
|
|
467
468
|
## API Reference
|
|
@@ -623,17 +624,16 @@ createHealthHandler({
|
|
|
623
624
|
|
|
624
625
|
### Page Metadata + OG Image
|
|
625
626
|
|
|
626
|
-
`@djangocfg/nextjs/og-image` builds complete page metadata
|
|
627
|
-
|
|
628
|
-
templates — Django renders and caches the PNG.
|
|
627
|
+
`@djangocfg/nextjs/og-image` builds complete page metadata: title templating,
|
|
628
|
+
canonical + hreflang alternates, OpenGraph, Twitter cards and icons.
|
|
629
629
|
|
|
630
630
|
See [`src/og-image/README.md`](./src/og-image/README.md) for full docs (the `og`
|
|
631
|
-
axis, `SiteMetaConfig`/`PageMeta` fields
|
|
631
|
+
axis, `SiteMetaConfig`/`PageMeta` fields).
|
|
632
632
|
|
|
633
633
|
#### `makeMetadataFactory(config)` — recommended
|
|
634
634
|
|
|
635
635
|
Binds a `SiteMetaConfig` once; returns a per-page factory. The OG image is set by
|
|
636
|
-
the single `og` field: `'static'` (default) · `
|
|
636
|
+
the single `og` field: `'static'` (default) · `{ image, alt? }`.
|
|
637
637
|
|
|
638
638
|
```tsx
|
|
639
639
|
import { makeMetadataFactory } from '@djangocfg/nextjs/og-image'
|
|
@@ -643,23 +643,21 @@ export const createMetadata = makeMetadataFactory({
|
|
|
643
643
|
ogImage: '/static/ogimage.png', locales: LOCALES,
|
|
644
644
|
})
|
|
645
645
|
|
|
646
|
-
export const metadata = createMetadata({ title: 'About', path: '/about' })
|
|
647
|
-
export const metadata = createMetadata({ title:
|
|
646
|
+
export const metadata = createMetadata({ title: 'About', path: '/about' }) // brand image
|
|
647
|
+
export const metadata = createMetadata({ title: p.name, og: { image: p.image } })
|
|
648
648
|
```
|
|
649
649
|
|
|
650
|
-
####
|
|
650
|
+
#### Per-page rendered cards
|
|
651
651
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
`OgSpec` decision point. Most pages use `createMetadata` and never touch these.
|
|
652
|
+
Use Next.js's `opengraph-image` file convention. It is discovered by filename
|
|
653
|
+
and overrides metadata, so this package needs no support for it — and offering
|
|
654
|
+
a second route to the same tag would only create a conflict.
|
|
656
655
|
|
|
657
|
-
|
|
658
|
-
import { buildOgUrl } from '@djangocfg/nextjs/og-image'
|
|
659
|
-
const url = buildOgUrl({ title: 'Hello', preset: 'DARK_BLUE' })
|
|
660
|
-
```
|
|
656
|
+
#### Low-level (escape hatches)
|
|
661
657
|
|
|
662
|
-
|
|
658
|
+
`resolveOgImage(spec, staticUrl, fallbackTitle)` is the `OgSpec` decision point;
|
|
659
|
+
`extractTitle(metadata)` reads a plain title out of Next.js's title shapes. Most
|
|
660
|
+
pages use `createMetadata` and never touch these.
|
|
663
661
|
|
|
664
662
|
### Navigation
|
|
665
663
|
|
package/dist/i18n/routing.d.mts
CHANGED
|
@@ -24,6 +24,7 @@ declare function createRouting(config?: Partial<I18nConfig>): {
|
|
|
24
24
|
localePrefix?: next_intl_routing.LocalePrefix<string[], "always" | "as-needed" | "never">;
|
|
25
25
|
domains?: never;
|
|
26
26
|
localeCookie?: boolean | {
|
|
27
|
+
name?: string;
|
|
27
28
|
maxAge?: number | undefined;
|
|
28
29
|
priority?: "low" | "medium" | "high" | undefined;
|
|
29
30
|
domain?: string | undefined;
|
|
@@ -31,7 +32,6 @@ declare function createRouting(config?: Partial<I18nConfig>): {
|
|
|
31
32
|
secure?: boolean | undefined;
|
|
32
33
|
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
33
34
|
partitioned?: boolean | undefined;
|
|
34
|
-
name?: string;
|
|
35
35
|
};
|
|
36
36
|
alternateLinks?: boolean;
|
|
37
37
|
localeDetection?: boolean;
|
|
@@ -46,6 +46,7 @@ declare const routing: {
|
|
|
46
46
|
localePrefix?: next_intl_routing.LocalePrefix<string[], "always" | "as-needed" | "never">;
|
|
47
47
|
domains?: never;
|
|
48
48
|
localeCookie?: boolean | {
|
|
49
|
+
name?: string;
|
|
49
50
|
maxAge?: number | undefined;
|
|
50
51
|
priority?: "low" | "medium" | "high" | undefined;
|
|
51
52
|
domain?: string | undefined;
|
|
@@ -53,7 +54,6 @@ declare const routing: {
|
|
|
53
54
|
secure?: boolean | undefined;
|
|
54
55
|
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
55
56
|
partitioned?: boolean | undefined;
|
|
56
|
-
name?: string;
|
|
57
57
|
};
|
|
58
58
|
alternateLinks?: boolean;
|
|
59
59
|
localeDetection?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/nextjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.540",
|
|
4
4
|
"description": "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs",
|
|
@@ -149,9 +149,9 @@
|
|
|
149
149
|
"ai-docs": "tsx src/ai/cli.ts"
|
|
150
150
|
},
|
|
151
151
|
"peerDependencies": {
|
|
152
|
-
"@djangocfg/devtools": "^2.1.
|
|
153
|
-
"@djangocfg/i18n": "^2.1.
|
|
154
|
-
"@djangocfg/ui-core": "^2.1.
|
|
152
|
+
"@djangocfg/devtools": "^2.1.540",
|
|
153
|
+
"@djangocfg/i18n": "^2.1.540",
|
|
154
|
+
"@djangocfg/ui-core": "^2.1.540",
|
|
155
155
|
"next": "^16.2.2"
|
|
156
156
|
},
|
|
157
157
|
"peerDependenciesMeta": {
|
|
@@ -170,11 +170,11 @@
|
|
|
170
170
|
"semver": "^7.8.5"
|
|
171
171
|
},
|
|
172
172
|
"devDependencies": {
|
|
173
|
-
"@djangocfg/devtools": "^2.1.
|
|
174
|
-
"@djangocfg/i18n": "^2.1.
|
|
175
|
-
"@djangocfg/layouts": "^2.1.
|
|
176
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
177
|
-
"@djangocfg/ui-core": "^2.1.
|
|
173
|
+
"@djangocfg/devtools": "^2.1.540",
|
|
174
|
+
"@djangocfg/i18n": "^2.1.540",
|
|
175
|
+
"@djangocfg/layouts": "^2.1.540",
|
|
176
|
+
"@djangocfg/typescript-config": "^2.1.540",
|
|
177
|
+
"@djangocfg/ui-core": "^2.1.540",
|
|
178
178
|
"@types/node": "^25.9.5",
|
|
179
179
|
"@types/react": "19.2.15",
|
|
180
180
|
"@types/react-dom": "19.2.3",
|