nuxt-seo-utils 8.6.0 → 9.0.0
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 +11 -15
- package/dist/cli.mjs +1 -1
- package/dist/module.d.mts +55 -3
- package/dist/module.d.ts +55 -3
- package/dist/module.json +2 -2
- package/dist/module.mjs +521 -31
- package/dist/runtime/app/composables/polyfills.d.ts +2 -2
- package/dist/runtime/app/composables/polyfills.js +2 -2
- package/dist/runtime/app/composables/schemaOrg.d.ts +2 -0
- package/dist/runtime/app/composables/schemaOrg.js +2 -0
- package/dist/runtime/app/composables/useBreadcrumbItems.js +3 -2
- package/dist/runtime/app/composables/useFallbackTitle.js +0 -8
- package/dist/runtime/app/index.d.ts +5 -0
- package/dist/runtime/app/index.js +3 -0
- package/dist/runtime/app/logic/applyDefaults.js +1 -2
- package/dist/runtime/app/logic/syncDerivedTags.js +25 -15
- package/dist/runtime/app/plugins/0.routeRules.d.ts +1 -1
- package/dist/runtime/app/plugins/0.routeRules.js +1 -1
- package/dist/runtime/app/plugins/1.absoluteImageUrls.server.d.ts +1 -1
- package/dist/runtime/app/plugins/1.absoluteImageUrls.server.js +1 -2
- package/dist/runtime/app/plugins/colorModeIcons.d.ts +1 -1
- package/dist/runtime/app/plugins/colorModeIcons.js +1 -1
- package/dist/runtime/app/plugins/defaults.d.ts +1 -1
- package/dist/runtime/app/plugins/defaultsWaitI18n.d.ts +1 -1
- package/dist/runtime/app/plugins/derivedTags.d.ts +1 -1
- package/dist/runtime/app/plugins/derivedTags.js +1 -2
- package/dist/runtime/app/plugins/inferSeoMetaPlugin.d.ts +1 -1
- package/dist/runtime/app/plugins/inferSeoMetaPlugin.js +2 -16
- package/dist/runtime/app/plugins/minifyScripts.server.d.ts +1 -1
- package/dist/runtime/app/plugins/minifyScripts.server.js +2 -11
- package/dist/runtime/app/plugins/siteConfig.d.ts +1 -1
- package/dist/runtime/app/plugins/siteConfig.js +1 -2
- package/dist/runtime/app/plugins/titles.d.ts +1 -1
- package/dist/runtime/app/plugins/titles.js +1 -2
- package/dist/runtime/app/plugins/titlesWaitI18n.d.ts +1 -1
- package/dist/runtime/app/plugins/titlesWaitI18n.js +1 -2
- package/dist/runtime/server/middleware/redirectCanonical.d.ts +1 -1
- package/dist/runtime/server/middleware/redirectCanonical.js +6 -6
- package/dist/runtime/server/middleware/redirects.d.ts +2 -0
- package/dist/runtime/server/middleware/redirects.js +21 -0
- package/dist/runtime/server/middleware/resolveImagesInPagesDir.d.ts +1 -1
- package/dist/runtime/server/middleware/resolveImagesInPagesDir.js +5 -6
- package/dist/runtime/server/plugins/minifyHtml.js +2 -9
- package/dist/runtime/server/routes/__nuxt-seo-utils/debug.d.ts +27 -1
- package/dist/runtime/server/routes/__nuxt-seo-utils/debug.js +2 -3
- package/dist/runtime/shared/minify.d.ts +0 -6
- package/dist/runtime/shared/minify.js +0 -60
- package/dist/runtime/shared/redirects.d.ts +40 -0
- package/dist/runtime/shared/redirects.js +59 -0
- package/dist/runtime/types.d.ts +15 -0
- package/dist/types.d.mts +1 -1
- package/package.json +42 -37
- package/skills/nuxt-seo-utils/SKILL.md +52 -6
package/README.md
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
<h1>nuxt-seo-utils</h1>
|
|
1
|
+
<h1><a href="https://nuxtseo.com"><img src=".github/assets/icon.svg" width="40" height="40" alt="Nuxt SEO" align="top"></a> nuxt-seo-utils</h1>
|
|
2
2
|
|
|
3
3
|
[![npm version][npm-version-src]][npm-version-href]
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
5
|
[![License][license-src]][license-href]
|
|
6
6
|
[![Nuxt][nuxt-src]][nuxt-href]
|
|
7
|
-
|
|
8
|
-
<a href="https://skilld.dev/gh/harlan-zw/nuxt-seo-utils">
|
|
9
|
-
<picture>
|
|
10
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://skilld.dev/b/harlan-zw/nuxt-seo-utils?theme=dark">
|
|
11
|
-
<source media="(prefers-color-scheme: light)" srcset="https://skilld.dev/b/harlan-zw/nuxt-seo-utils?theme=light">
|
|
12
|
-
<img alt="Skill repository on skilld.dev" src="https://skilld.dev/b/harlan-zw/nuxt-seo-utils?theme=light">
|
|
13
|
-
</picture>
|
|
14
|
-
</a>
|
|
7
|
+
[![Skill repository on skilld.dev][skilld-src]][skilld-href]
|
|
15
8
|
|
|
16
9
|
Nuxt SEO Utils is a collection of defaults and utilities to improve your Nuxt site's discoverability and shareability.
|
|
17
10
|
|
|
@@ -37,14 +30,14 @@ While there are several features covering many aspects of SEO, it covers importa
|
|
|
37
30
|
- 🧩 Site config template params `useHead({ title: '%site.title' })`
|
|
38
31
|
- 🍞 Breadcrumb composable
|
|
39
32
|
- 🧙 Best practice defaults and enhanced titles
|
|
40
|
-
- ⚡
|
|
33
|
+
- ⚡ Parser-based minification of static JavaScript and CSS at build time, plus optional JSON/CSS minification during SSR
|
|
41
34
|
|
|
42
35
|
## Installation
|
|
43
36
|
|
|
44
37
|
Install `nuxt-seo-utils` dependency to your project:
|
|
45
38
|
|
|
46
39
|
```bash
|
|
47
|
-
npx
|
|
40
|
+
npx nuxt module add nuxt-seo-utils
|
|
48
41
|
```
|
|
49
42
|
|
|
50
43
|
> [!TIP]
|
|
@@ -73,14 +66,17 @@ npx nuxi@latest module add nuxt-seo-utils
|
|
|
73
66
|
Licensed under the [MIT license](https://github.com/harlan-zw/nuxt-seo-utils/blob/main/LICENSE.md).
|
|
74
67
|
|
|
75
68
|
<!-- Badges -->
|
|
76
|
-
[npm-version-src]: https://img.shields.io/npm/v/nuxt-seo-utils/latest.svg?style=flat&
|
|
69
|
+
[npm-version-src]: https://img.shields.io/npm/v/nuxt-seo-utils/latest.svg?style=flat&labelColor=16152b&color=00a63e
|
|
77
70
|
[npm-version-href]: https://npmjs.com/package/nuxt-seo-utils
|
|
78
71
|
|
|
79
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-seo-utils.svg?style=flat&
|
|
72
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-seo-utils.svg?style=flat&labelColor=16152b&color=00a63e
|
|
80
73
|
[npm-downloads-href]: https://npmjs.com/package/nuxt-seo-utils
|
|
81
74
|
|
|
82
|
-
[license-src]: https://img.shields.io/github/license/harlan-zw/nuxt-seo-utils.svg?style=flat&
|
|
75
|
+
[license-src]: https://img.shields.io/github/license/harlan-zw/nuxt-seo-utils.svg?style=flat&labelColor=16152b&color=00a63e
|
|
83
76
|
[license-href]: https://github.com/harlan-zw/nuxt-seo-utils/blob/main/LICENSE.md
|
|
84
77
|
|
|
85
|
-
[nuxt-src]: https://img.shields.io/badge/Nuxt-
|
|
78
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-16152b?logo=nuxt&style=flat
|
|
86
79
|
[nuxt-href]: https://nuxt.com
|
|
80
|
+
|
|
81
|
+
[skilld-src]: https://skilld.dev/b/harlan-zw/nuxt-seo-utils?style=flat&labelColor=16152b&color=00a63e&logoColor=ffffff
|
|
82
|
+
[skilld-href]: https://skilld.dev/gh/harlan-zw/nuxt-seo-utils
|
package/dist/cli.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { p as pngToIco } from './shared/nuxt-seo-utils.NAV2YNQn.mjs';
|
|
|
9
9
|
import 'node:buffer';
|
|
10
10
|
|
|
11
11
|
const name = "nuxt-seo-utils";
|
|
12
|
-
const version = "
|
|
12
|
+
const version = "9.0.0";
|
|
13
13
|
const description = "SEO utilities to improve your Nuxt sites discoverability and shareability";
|
|
14
14
|
|
|
15
15
|
const ICON_SIZES = [
|
package/dist/module.d.mts
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { MetaFlatSerializable } from '../dist/runtime/types.js';
|
|
3
3
|
|
|
4
|
+
/** A calendar date, such as `'2026-10-13'`. */
|
|
5
|
+
type RedirectDate = `${number}-${number}-${number}`;
|
|
6
|
+
interface RedirectMeta {
|
|
7
|
+
/** The date you added the entry. The review clock starts here. */
|
|
8
|
+
addedAt: RedirectDate;
|
|
9
|
+
/** The date you last decided to keep the entry. It restarts the review clock. */
|
|
10
|
+
reviewedAt?: RedirectDate;
|
|
11
|
+
/** A private note for the site owner. Visitors never see it. */
|
|
12
|
+
reason?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The old URL moved. Requests get a permanent redirect to `to`. */
|
|
15
|
+
interface MovedUrl extends RedirectMeta {
|
|
16
|
+
/** A path on this site, such as `/blog/new-post`, or an absolute URL. End it with `/**` to keep the rest of a `/**` source path. */
|
|
17
|
+
to: string;
|
|
18
|
+
/** @default 301 */
|
|
19
|
+
statusCode?: 301 | 308;
|
|
20
|
+
}
|
|
21
|
+
/** The old URL has no replacement. Requests get the error page with this status. */
|
|
22
|
+
interface GoneUrl extends RedirectMeta {
|
|
23
|
+
to?: never;
|
|
24
|
+
statusCode: 410 | 404;
|
|
25
|
+
}
|
|
26
|
+
type RedirectInput = MovedUrl | GoneUrl;
|
|
27
|
+
/**
|
|
28
|
+
* Old URLs keyed by path, without `app.baseURL`.
|
|
29
|
+
* A trailing `/**` matches the path and every path below it.
|
|
30
|
+
*/
|
|
31
|
+
type Redirects = Record<string, RedirectInput>;
|
|
32
|
+
|
|
4
33
|
interface ModuleOptions {
|
|
5
34
|
/**
|
|
6
35
|
* Whether the SEO experiements should run.
|
|
@@ -104,6 +133,29 @@ interface ModuleOptions {
|
|
|
104
133
|
* @default false
|
|
105
134
|
*/
|
|
106
135
|
redirectToCanonicalSiteUrl?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Old URLs keyed by path, without `app.baseURL`. A trailing `/**` matches the path and every path below it.
|
|
138
|
+
*
|
|
139
|
+
* - A moved URL sets `to`. Requests get a permanent redirect (301, or 308).
|
|
140
|
+
* - A gone URL sets `statusCode: 410` (or 404) and no `to`. Requests get the error page with that status.
|
|
141
|
+
*
|
|
142
|
+
* Every entry records `addedAt`. The build lists entries older than `redirectReviewAfterDays` for review.
|
|
143
|
+
* No entry expires on its own.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* redirects: {
|
|
147
|
+
* '/old-post': { to: '/blog/new-post', addedAt: '2026-10-13' },
|
|
148
|
+
* '/spring-sale': { statusCode: 410, addedAt: '2026-10-13', reason: 'The sale ended.' },
|
|
149
|
+
* }
|
|
150
|
+
*/
|
|
151
|
+
redirects?: Redirects;
|
|
152
|
+
/**
|
|
153
|
+
* Days after an entry's `addedAt` or `reviewedAt` until `nuxt dev` and `nuxt build` list it for review.
|
|
154
|
+
* Set `false` to turn off the review.
|
|
155
|
+
*
|
|
156
|
+
* @default 365
|
|
157
|
+
*/
|
|
158
|
+
redirectReviewAfterDays?: number | false;
|
|
107
159
|
/**
|
|
108
160
|
* Sets the `tagPriority` for SEO and Open Graph meta tags generated by this module.
|
|
109
161
|
* Uses unhead's priority aliases: `'low'` (default) ensures module tags act as fallbacks
|
|
@@ -124,8 +176,8 @@ interface ModuleOptions {
|
|
|
124
176
|
* - `false`: Disabled.
|
|
125
177
|
* - `{ build?: boolean, runtime?: boolean }`: Toggle each mode independently.
|
|
126
178
|
*
|
|
127
|
-
* **Build mode**: Minifies static `app.head`
|
|
128
|
-
* **Runtime mode**: Minifies
|
|
179
|
+
* **Build mode**: Minifies static `app.head` JavaScript/styles with parser-based tooling, plus JSON/CSS in prerendered HTML.
|
|
180
|
+
* **Runtime mode**: Minifies inline JSON/CSS per SSR request. Preserves dynamic JavaScript and custom script types.
|
|
129
181
|
*
|
|
130
182
|
* @default { build: true, runtime: false }
|
|
131
183
|
*/
|
|
@@ -150,4 +202,4 @@ interface ModuleOptions {
|
|
|
150
202
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
151
203
|
|
|
152
204
|
export { _default as default };
|
|
153
|
-
export type { ModuleOptions };
|
|
205
|
+
export type { GoneUrl, ModuleOptions, MovedUrl, RedirectDate, RedirectInput, Redirects };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { MetaFlatSerializable } from '../dist/runtime/types.js';
|
|
3
3
|
|
|
4
|
+
/** A calendar date, such as `'2026-10-13'`. */
|
|
5
|
+
type RedirectDate = `${number}-${number}-${number}`;
|
|
6
|
+
interface RedirectMeta {
|
|
7
|
+
/** The date you added the entry. The review clock starts here. */
|
|
8
|
+
addedAt: RedirectDate;
|
|
9
|
+
/** The date you last decided to keep the entry. It restarts the review clock. */
|
|
10
|
+
reviewedAt?: RedirectDate;
|
|
11
|
+
/** A private note for the site owner. Visitors never see it. */
|
|
12
|
+
reason?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The old URL moved. Requests get a permanent redirect to `to`. */
|
|
15
|
+
interface MovedUrl extends RedirectMeta {
|
|
16
|
+
/** A path on this site, such as `/blog/new-post`, or an absolute URL. End it with `/**` to keep the rest of a `/**` source path. */
|
|
17
|
+
to: string;
|
|
18
|
+
/** @default 301 */
|
|
19
|
+
statusCode?: 301 | 308;
|
|
20
|
+
}
|
|
21
|
+
/** The old URL has no replacement. Requests get the error page with this status. */
|
|
22
|
+
interface GoneUrl extends RedirectMeta {
|
|
23
|
+
to?: never;
|
|
24
|
+
statusCode: 410 | 404;
|
|
25
|
+
}
|
|
26
|
+
type RedirectInput = MovedUrl | GoneUrl;
|
|
27
|
+
/**
|
|
28
|
+
* Old URLs keyed by path, without `app.baseURL`.
|
|
29
|
+
* A trailing `/**` matches the path and every path below it.
|
|
30
|
+
*/
|
|
31
|
+
type Redirects = Record<string, RedirectInput>;
|
|
32
|
+
|
|
4
33
|
interface ModuleOptions {
|
|
5
34
|
/**
|
|
6
35
|
* Whether the SEO experiements should run.
|
|
@@ -104,6 +133,29 @@ interface ModuleOptions {
|
|
|
104
133
|
* @default false
|
|
105
134
|
*/
|
|
106
135
|
redirectToCanonicalSiteUrl?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Old URLs keyed by path, without `app.baseURL`. A trailing `/**` matches the path and every path below it.
|
|
138
|
+
*
|
|
139
|
+
* - A moved URL sets `to`. Requests get a permanent redirect (301, or 308).
|
|
140
|
+
* - A gone URL sets `statusCode: 410` (or 404) and no `to`. Requests get the error page with that status.
|
|
141
|
+
*
|
|
142
|
+
* Every entry records `addedAt`. The build lists entries older than `redirectReviewAfterDays` for review.
|
|
143
|
+
* No entry expires on its own.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* redirects: {
|
|
147
|
+
* '/old-post': { to: '/blog/new-post', addedAt: '2026-10-13' },
|
|
148
|
+
* '/spring-sale': { statusCode: 410, addedAt: '2026-10-13', reason: 'The sale ended.' },
|
|
149
|
+
* }
|
|
150
|
+
*/
|
|
151
|
+
redirects?: Redirects;
|
|
152
|
+
/**
|
|
153
|
+
* Days after an entry's `addedAt` or `reviewedAt` until `nuxt dev` and `nuxt build` list it for review.
|
|
154
|
+
* Set `false` to turn off the review.
|
|
155
|
+
*
|
|
156
|
+
* @default 365
|
|
157
|
+
*/
|
|
158
|
+
redirectReviewAfterDays?: number | false;
|
|
107
159
|
/**
|
|
108
160
|
* Sets the `tagPriority` for SEO and Open Graph meta tags generated by this module.
|
|
109
161
|
* Uses unhead's priority aliases: `'low'` (default) ensures module tags act as fallbacks
|
|
@@ -124,8 +176,8 @@ interface ModuleOptions {
|
|
|
124
176
|
* - `false`: Disabled.
|
|
125
177
|
* - `{ build?: boolean, runtime?: boolean }`: Toggle each mode independently.
|
|
126
178
|
*
|
|
127
|
-
* **Build mode**: Minifies static `app.head`
|
|
128
|
-
* **Runtime mode**: Minifies
|
|
179
|
+
* **Build mode**: Minifies static `app.head` JavaScript/styles with parser-based tooling, plus JSON/CSS in prerendered HTML.
|
|
180
|
+
* **Runtime mode**: Minifies inline JSON/CSS per SSR request. Preserves dynamic JavaScript and custom script types.
|
|
129
181
|
*
|
|
130
182
|
* @default { build: true, runtime: false }
|
|
131
183
|
*/
|
|
@@ -150,4 +202,4 @@ interface ModuleOptions {
|
|
|
150
202
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
151
203
|
|
|
152
204
|
export { _default as default };
|
|
153
|
-
export type { ModuleOptions };
|
|
205
|
+
export type { GoneUrl, ModuleOptions, MovedUrl, RedirectDate, RedirectInput, Redirects };
|
package/dist/module.json
CHANGED