@nuxtjs/seo 2.0.0-rc.9 → 2.0.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/LICENSE.md +9 -0
- package/README.md +40 -48
- package/const.d.ts +1 -0
- package/dist/const.d.ts +1 -0
- package/dist/const.mjs +20 -0
- package/dist/module.d.ts +2 -46
- package/dist/module.json +7 -3
- package/dist/module.mjs +9 -112
- package/dist/types.d.mts +8 -11
- package/dist/types.d.ts +8 -11
- package/package.json +47 -32
- package/dist/module.d.mts +0 -46
- package/dist/runtime/nitro/middleware/redirect.d.ts +0 -2
- package/dist/runtime/nitro/middleware/redirect.mjs +0 -13
- package/dist/runtime/nitro/tsconfig.json +0 -3
- package/dist/runtime/nuxt/composables/polyfills.d.ts +0 -10
- package/dist/runtime/nuxt/composables/polyfills.mjs +0 -18
- package/dist/runtime/nuxt/composables/useBreadcrumbItems.d.ts +0 -86
- package/dist/runtime/nuxt/composables/useBreadcrumbItems.mjs +0 -99
- package/dist/runtime/nuxt/logic/applyDefaults.d.ts +0 -1
- package/dist/runtime/nuxt/logic/applyDefaults.mjs +0 -46
- package/dist/runtime/nuxt/plugin/defaults.d.ts +0 -2
- package/dist/runtime/nuxt/plugin/defaults.mjs +0 -11
- package/dist/runtime/nuxt/plugin/defaultsWaitI18n.server.d.ts +0 -2
- package/dist/runtime/nuxt/plugin/defaultsWaitI18n.server.mjs +0 -14
- package/dist/runtime/nuxt/plugin/titles.d.ts +0 -2
- package/dist/runtime/nuxt/plugin/titles.mjs +0 -31
- package/dist/runtime/nuxt/tsconfig.json +0 -3
- package/dist/runtime/pure/breadcrumbs.d.ts +0 -1
- package/dist/runtime/pure/breadcrumbs.mjs +0 -18
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Harlan Wilton
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,71 +1,50 @@
|
|
|
1
|
-
<h1
|
|
1
|
+
<h1>@nuxtjs/seo</h1>
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<a href="https://www.npmjs.com/package/@nuxtjs/seo" target="__blank"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@nuxtjs/seo?flat&colorA=002438&colorB=28CF8D"></a>
|
|
8
|
-
<a href="https://github.com/harlan-zw/nuxt-seo" target="__blank"><img alt="GitHub stars" src="https://img.shields.io/github/stars/harlan-zw/nuxt-seo?flat&colorA=002438&colorB=28CF8D"></a>
|
|
9
|
-
</p>
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![License][license-src]][license-href]
|
|
6
|
+
[![Nuxt][nuxt-src]][nuxt-href]
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
The Nuxt SEO module is an all-in-one SEO solution for Nuxt. It combines 6 SEO modules and best practices into one module that requires minimal effort to configure.
|
|
9
|
+
|
|
10
|
+
## Modules
|
|
11
|
+
|
|
12
|
+
- 🤖 [@nuxtjs/robots](https://github.com/nuxt-modules/robots) - Manage site crawling
|
|
13
|
+
- 📄 [@nuxtjs/sitemap](https://github.com/nuxt-modules/sitemap) - Sitemap.xml Support
|
|
14
|
+
- 🔎 [nuxt-schema-org](https://github.com/harlan-zw/nuxt-schema-org) - Generate Schema.org JSON-LD for SEO
|
|
15
|
+
- △ [nuxt-seo-utils](https://github.com/harlan-zw/nuxt-seo-utils) - Experimental SEO meta features
|
|
16
|
+
- 🖼️ [nuxt-og-image](https://github.com/nuxt-modules/og-image) - Generate dynamic social share images
|
|
17
|
+
- ✅ [nuxt-link-checker](https://github.com/harlan-zw/nuxt-link-checker) - Check for broken links
|
|
14
18
|
|
|
15
19
|
<p align="center">
|
|
16
20
|
<table>
|
|
17
21
|
<tbody>
|
|
18
22
|
<td align="center">
|
|
19
|
-
<img width="800" height="0" /><br>
|
|
20
|
-
<i>Status:</i> <a href="https://github.com/harlan-zw/nuxt-seo/releases/tag/v2.0.0">v2 RC is available</a></b> <br>
|
|
21
|
-
<sup> Please report any issues 🐛</sup><br>
|
|
22
23
|
<sub>Made possible by my <a href="https://github.com/sponsors/harlan-zw">Sponsor Program 💖</a><br> Follow me <a href="https://twitter.com/harlan_zw">@harlan_zw</a> 🐦 • Join <a href="https://discord.gg/275MBUBvgP">Discord</a> for help</sub><br>
|
|
23
|
-
<img width="800" height="0" />
|
|
24
24
|
</td>
|
|
25
25
|
</tbody>
|
|
26
26
|
</table>
|
|
27
27
|
</p>
|
|
28
28
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
Technical SEO is hard. It requires many moving parts that need to work well together. Configuring all of these parts
|
|
32
|
-
correctly is a challenge.
|
|
33
|
-
|
|
34
|
-
Nuxt SEO is the total SEO solution for Nuxt. It combines 7 SEO modules and best practices into one module that requires
|
|
35
|
-
minimal effort to configure.
|
|
36
|
-
|
|
37
|
-
With powerful APIs built for fully dynamic sites and zero-config defaults for static sites.
|
|
29
|
+
## Installation
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- 📖 [@nuxtjs/sitemap](https://github.com/nuxt-modules/sitemap) - Sitemap.xml Support
|
|
42
|
-
- 🤖 [nuxt-simple-robots](https://github.com/harlan-zw/nuxt-simple-robots) - Manage site crawling
|
|
43
|
-
- 🔎 [nuxt-schema-org](https://unhead-schema-org.harlanzw.com/) - Generate Schema.org JSON-LD for SEO
|
|
44
|
-
- △ [nuxt-seo-experiments](https://github.com/harlan-zw/nuxt-seo-experiments) - Experimental SEO meta features
|
|
45
|
-
- 🖼️ [nuxt-og-image](https://github.com/nuxt-modules/og-image) - Generate dynamic social share images
|
|
46
|
-
- ✅ [nuxt-link-checker](https://github.com/harlan-zw/nuxt-link-checker) - Check for broken links
|
|
47
|
-
|
|
48
|
-
## Install
|
|
49
|
-
|
|
50
|
-
1. Install `@nuxtjs/seo` dependency to your project:
|
|
31
|
+
Install `@nuxtjs/seo` dependency to your project:
|
|
51
32
|
|
|
52
33
|
```sh
|
|
53
|
-
|
|
54
|
-
yarn add -D @nuxtjs/seo
|
|
55
|
-
npm install -D @nuxtjs/seo
|
|
34
|
+
npx nuxi@latest module add seo
|
|
56
35
|
```
|
|
57
36
|
|
|
58
|
-
|
|
37
|
+
Once installed check the [Default Module Features](https://nuxtseo.com/docs/nuxt-seo/guides/using-the-modules) guide
|
|
38
|
+
for a quick start.
|
|
59
39
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
```
|
|
40
|
+
## Documentation
|
|
41
|
+
|
|
42
|
+
[📖 Read the full documentation](https://nuxtseo.com/) for more information.
|
|
65
43
|
|
|
66
|
-
|
|
44
|
+
## Stackblitz
|
|
67
45
|
|
|
68
|
-
|
|
46
|
+
For reproductions and demo environments, you can use the [Nuxt SEO Basic Reproduction](https://stackblitz.com/edit/nuxt-starter-gfrej6?file=nuxt.config.ts)
|
|
47
|
+
template.
|
|
69
48
|
|
|
70
49
|
## Sponsors
|
|
71
50
|
|
|
@@ -77,4 +56,17 @@ All features are enabled by default. Learn more by exploring the [documentation]
|
|
|
77
56
|
|
|
78
57
|
## License
|
|
79
58
|
|
|
80
|
-
|
|
59
|
+
Licensed under the [MIT license](https://github.com/harlan-zw/nuxt-seo/blob/main/LICENSE.md).
|
|
60
|
+
|
|
61
|
+
<!-- Badges -->
|
|
62
|
+
[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/seo/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
63
|
+
[npm-version-href]: https://npmjs.com/package/@nuxtjs/seo
|
|
64
|
+
|
|
65
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@nuxtjs/seo.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
66
|
+
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/seo
|
|
67
|
+
|
|
68
|
+
[license-src]: https://img.shields.io/github/license/harlan-zw/nuxt-seo.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
69
|
+
[license-href]: https://github.com/harlan-zw/nuxt-seo/blob/main/LICENSE.md
|
|
70
|
+
|
|
71
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
|
|
72
|
+
[nuxt-href]: https://nuxt.com
|
package/const.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/const'
|
package/dist/const.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "/home/harlan/packages/nuxt-seo-solo/src/const";
|
package/dist/const.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import jiti from "file:///home/harlan/packages/nuxt-seo-solo/node_modules/.pnpm/jiti@1.21.6/node_modules/jiti/lib/index.js";
|
|
2
|
+
|
|
3
|
+
/** @type {import("/home/harlan/packages/nuxt-seo-solo/src/const")} */
|
|
4
|
+
const _module = jiti(null, {
|
|
5
|
+
"esmResolve": true,
|
|
6
|
+
"interopDefault": true,
|
|
7
|
+
"alias": {
|
|
8
|
+
"@nuxtjs/seo": "/home/harlan/packages/nuxt-seo-solo"
|
|
9
|
+
}
|
|
10
|
+
})("/home/harlan/packages/nuxt-seo-solo/src/const.ts");
|
|
11
|
+
|
|
12
|
+
export const NuxtSEO = _module.NuxtSEO;
|
|
13
|
+
export const SiteConfigModule = _module.SiteConfigModule;
|
|
14
|
+
export const RobotsModule = _module.RobotsModule;
|
|
15
|
+
export const SitemapModule = _module.SitemapModule;
|
|
16
|
+
export const OgImageModule = _module.OgImageModule;
|
|
17
|
+
export const LinkCheckerModule = _module.LinkCheckerModule;
|
|
18
|
+
export const SeoUtilsModule = _module.SeoUtilsModule;
|
|
19
|
+
export const SchemaOrgModule = _module.SchemaOrgModule;
|
|
20
|
+
export const modules = _module.modules;
|
package/dist/module.d.ts
CHANGED
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface ModuleOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Will ensure a title is always set by providing a fallback title based on the casing the last slug segment.
|
|
6
|
-
*
|
|
7
|
-
* @default true
|
|
8
|
-
*/
|
|
9
|
-
fallbackTitle?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Will set up a number of defaults for meta tags and Schema.org, if the modules and config are available.
|
|
12
|
-
*
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
automaticDefaults?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* When enabled, it will redirect any request to the canonical domain (site url) using a 301 redirect on non-dev environments.
|
|
18
|
-
*
|
|
19
|
-
* E.g if the site url is 'www.example.com' and the user visits 'example.com',
|
|
20
|
-
* they will be redirected to 'www.example.com'.
|
|
21
|
-
*
|
|
22
|
-
* This is useful for SEO as it prevents duplicate content and consolidates page rank.
|
|
23
|
-
*
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
redirectToCanonicalSiteUrl?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Whether the module should be loaded.
|
|
29
|
-
*/
|
|
30
|
-
enabled: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the debugging mode should be enabled.
|
|
33
|
-
*
|
|
34
|
-
* @default `nuxt.options.debug`
|
|
35
|
-
*/
|
|
36
|
-
debug: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Whether the Nuxt SEO splash should be shown when Nuxt is started.
|
|
39
|
-
*
|
|
40
|
-
* @default `nuxt.options.dev`
|
|
41
|
-
*/
|
|
42
|
-
splash: boolean;
|
|
43
|
-
}
|
|
44
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
45
|
-
|
|
46
|
-
export { type ModuleOptions, _default as default };
|
|
1
|
+
export * from "/home/harlan/packages/nuxt-seo-solo/src/module";
|
|
2
|
+
export { default } from "/home/harlan/packages/nuxt-seo-solo/src/module";
|
package/dist/module.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxtseo",
|
|
3
3
|
"compatibility": {
|
|
4
|
-
"nuxt": "
|
|
4
|
+
"nuxt": ">=3.7.0",
|
|
5
5
|
"bridge": false
|
|
6
6
|
},
|
|
7
|
-
"configKey": "
|
|
8
|
-
"version": "2.0.
|
|
7
|
+
"configKey": "nuxtseo",
|
|
8
|
+
"version": "2.0.1",
|
|
9
|
+
"builder": {
|
|
10
|
+
"@nuxt/module-builder": "0.8.4",
|
|
11
|
+
"unbuild": "2.0.0"
|
|
12
|
+
}
|
|
9
13
|
}
|
package/dist/module.mjs
CHANGED
|
@@ -1,115 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { colors } from 'consola/utils';
|
|
3
|
-
import { installNuxtSiteConfig } from 'nuxt-site-config-kit';
|
|
4
|
-
import { readPackageJSON } from 'pkg-types';
|
|
5
|
-
import { $fetch } from 'ofetch';
|
|
1
|
+
import jiti from "file:///home/harlan/packages/nuxt-seo-solo/node_modules/.pnpm/jiti@1.21.6/node_modules/jiti/lib/index.js";
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"nuxt-link-checker"
|
|
14
|
-
];
|
|
15
|
-
const module = defineNuxtModule({
|
|
16
|
-
meta: {
|
|
17
|
-
name: "nuxtseo",
|
|
18
|
-
compatibility: {
|
|
19
|
-
nuxt: "^3.7.0",
|
|
20
|
-
bridge: false
|
|
21
|
-
},
|
|
22
|
-
configKey: "seo"
|
|
23
|
-
},
|
|
24
|
-
defaults(nuxt) {
|
|
25
|
-
return {
|
|
26
|
-
enabled: true,
|
|
27
|
-
debug: nuxt.options.debug,
|
|
28
|
-
redirectToCanonicalSiteUrl: false,
|
|
29
|
-
splash: nuxt.options.dev,
|
|
30
|
-
automaticDefaults: true,
|
|
31
|
-
fallbackTitle: true
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
async setup(config, nuxt) {
|
|
35
|
-
const { resolve, resolvePath } = createResolver(import.meta.url);
|
|
36
|
-
const { name, version } = await readPackageJSON(resolve("../package.json"));
|
|
37
|
-
const logger = useLogger(name);
|
|
38
|
-
logger.level = config.debug ? 4 : 3;
|
|
39
|
-
if (config.enabled === false) {
|
|
40
|
-
logger.debug("The module is disabled, skipping setup.");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
await installNuxtSiteConfig();
|
|
44
|
-
for (const module of Modules)
|
|
45
|
-
await installModule(await resolvePath(module));
|
|
46
|
-
if (config.automaticDefaults) {
|
|
47
|
-
if (hasNuxtModule("@nuxtjs/i18n")) {
|
|
48
|
-
addPlugin({
|
|
49
|
-
src: resolve(`./runtime/nuxt/plugin/defaultsWaitI18n.server`),
|
|
50
|
-
mode: "server"
|
|
51
|
-
});
|
|
52
|
-
addPlugin({
|
|
53
|
-
src: resolve(`./runtime/nuxt/plugin/defaults`),
|
|
54
|
-
mode: "client"
|
|
55
|
-
});
|
|
56
|
-
} else {
|
|
57
|
-
addPlugin({
|
|
58
|
-
src: resolve(`./runtime/nuxt/plugin/defaults`)
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (config.fallbackTitle) {
|
|
63
|
-
addPlugin({
|
|
64
|
-
src: resolve("./runtime/nuxt/plugin/titles")
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (!hasNuxtModule("@nuxtjs/i18n")) {
|
|
68
|
-
addImports({
|
|
69
|
-
from: resolve(`./runtime/nuxt/composables/polyfills`),
|
|
70
|
-
name: "useI18n"
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
addImports({
|
|
74
|
-
from: resolve(`./runtime/nuxt/composables/useBreadcrumbItems`),
|
|
75
|
-
name: "useBreadcrumbItems"
|
|
76
|
-
});
|
|
77
|
-
const polyfills = {
|
|
78
|
-
schemaOrg: ["useSchemaOrg", "defineWebSite", "defineWebPage"]
|
|
79
|
-
};
|
|
80
|
-
for (const [module, composables] of Object.entries(polyfills)) {
|
|
81
|
-
if (nuxt.options[module]?.enable === false) {
|
|
82
|
-
composables.forEach((name2) => {
|
|
83
|
-
addImports({
|
|
84
|
-
from: resolve("./runtime/nuxt/composables/polyfills"),
|
|
85
|
-
name: name2
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
nuxt.options.experimental.headNext = true;
|
|
91
|
-
if (config.redirectToCanonicalSiteUrl) {
|
|
92
|
-
addServerHandler({
|
|
93
|
-
handler: resolve("./runtime/nitro/middleware/redirect"),
|
|
94
|
-
middleware: true
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (config.splash && !version.includes("rc") && nuxt.options.dev) {
|
|
98
|
-
logger.log("");
|
|
99
|
-
let latestTag = `v${version}`;
|
|
100
|
-
latestTag = (await $fetch("https://ungh.unjs.io/repos/harlan-zw/nuxt-seo/releases/latest", {
|
|
101
|
-
timeout: 2e3
|
|
102
|
-
}).catch(() => {
|
|
103
|
-
return { release: { tag: `v${version}` } };
|
|
104
|
-
})).release.tag;
|
|
105
|
-
const upToDate = latestTag === `v${version}`;
|
|
106
|
-
logger.log(`${colors.green("Nuxt SEO")} ${colors.yellow(`v${version}`)} ${colors.gray(`by ${colors.underline("@harlan_zw")}`)}`);
|
|
107
|
-
if (!upToDate)
|
|
108
|
-
logger.log(`${colors.gray(" \u251C\u2500 ")}\u{1F389} New version available!${colors.gray(` Run ${colors.underline(`npm i @nuxtjs/seo@${latestTag}`)} to update.`)}`);
|
|
109
|
-
logger.log(colors.dim(" \u2514\u2500 \u{1F9EA} Help get Nuxt SEO stable by providing feedback https://github.com/harlan-zw/nuxt-seo/discussions/108"));
|
|
110
|
-
logger.log("");
|
|
111
|
-
}
|
|
3
|
+
/** @type {import("/home/harlan/packages/nuxt-seo-solo/src/module")} */
|
|
4
|
+
const _module = jiti(null, {
|
|
5
|
+
"esmResolve": true,
|
|
6
|
+
"interopDefault": true,
|
|
7
|
+
"alias": {
|
|
8
|
+
"@nuxtjs/seo": "/home/harlan/packages/nuxt-seo-solo"
|
|
112
9
|
}
|
|
113
|
-
});
|
|
10
|
+
})("/home/harlan/packages/nuxt-seo-solo/src/module.ts");
|
|
114
11
|
|
|
115
|
-
export
|
|
12
|
+
export default _module;
|
package/dist/types.d.mts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
+
import type { ModuleHooks, ModuleRuntimeHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module.js'
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare module '@nuxt/schema' {
|
|
6
|
-
interface NuxtConfig { ['seo']?: Partial<ModuleOptions> }
|
|
7
|
-
interface NuxtOptions { ['seo']?: ModuleOptions }
|
|
3
|
+
declare module '#app' {
|
|
4
|
+
interface RuntimeNuxtHooks extends ModuleRuntimeHooks {}
|
|
8
5
|
}
|
|
9
6
|
|
|
10
|
-
declare module 'nuxt/schema' {
|
|
11
|
-
interface
|
|
12
|
-
interface
|
|
7
|
+
declare module '@nuxt/schema' {
|
|
8
|
+
interface NuxtHooks extends ModuleHooks {}
|
|
9
|
+
interface RuntimeConfig extends ModuleRuntimeConfig {}
|
|
10
|
+
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
export type { ModuleOptions, default } from './module.js'
|
|
13
|
+
export * from "./module.js"
|
package/dist/types.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
+
import type { ModuleHooks, ModuleRuntimeHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module'
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare module '@nuxt/schema' {
|
|
6
|
-
interface NuxtConfig { ['seo']?: Partial<ModuleOptions> }
|
|
7
|
-
interface NuxtOptions { ['seo']?: ModuleOptions }
|
|
3
|
+
declare module '#app' {
|
|
4
|
+
interface RuntimeNuxtHooks extends ModuleRuntimeHooks {}
|
|
8
5
|
}
|
|
9
6
|
|
|
10
|
-
declare module 'nuxt/schema' {
|
|
11
|
-
interface
|
|
12
|
-
interface
|
|
7
|
+
declare module '@nuxt/schema' {
|
|
8
|
+
interface NuxtHooks extends ModuleHooks {}
|
|
9
|
+
interface RuntimeConfig extends ModuleRuntimeConfig {}
|
|
10
|
+
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
export type { ModuleOptions, default } from './module'
|
|
13
|
+
export * from "./module"
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/seo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
5
|
-
"packageManager": "pnpm@8.15.4",
|
|
4
|
+
"version": "2.0.1",
|
|
6
5
|
"description": "The all-in-one SEO layer for Nuxt 3.",
|
|
7
6
|
"author": {
|
|
8
7
|
"name": "Harlan Wilton",
|
|
@@ -24,42 +23,43 @@
|
|
|
24
23
|
"types": "./dist/types.d.ts",
|
|
25
24
|
"import": "./dist/module.mjs",
|
|
26
25
|
"require": "./dist/module.cjs"
|
|
26
|
+
},
|
|
27
|
+
"./const": {
|
|
28
|
+
"types": "./dist/const.d.ts",
|
|
29
|
+
"import": "./dist/const.mjs"
|
|
27
30
|
}
|
|
28
31
|
},
|
|
29
32
|
"main": "./dist/module.cjs",
|
|
30
33
|
"types": "./dist/types.d.ts",
|
|
31
34
|
"files": [
|
|
35
|
+
"const.d.ts",
|
|
32
36
|
"dist"
|
|
33
37
|
],
|
|
34
38
|
"dependencies": {
|
|
35
|
-
"@nuxt/kit": "
|
|
36
|
-
"@nuxtjs/
|
|
37
|
-
"
|
|
38
|
-
"nuxt-link-checker": "^
|
|
39
|
-
"nuxt-og-image": "^
|
|
40
|
-
"nuxt-schema-org": "^
|
|
41
|
-
"nuxt-seo-
|
|
42
|
-
"nuxt-
|
|
43
|
-
"nuxt-site-config": "^2.2.11",
|
|
44
|
-
"nuxt-site-config-kit": "^2.2.11",
|
|
45
|
-
"pkg-types": "^1.0.3",
|
|
46
|
-
"ufo": "^1.4.0"
|
|
39
|
+
"@nuxt/kit": "3.14.1592",
|
|
40
|
+
"@nuxtjs/robots": "^5.0.0",
|
|
41
|
+
"@nuxtjs/sitemap": "^7.0.0",
|
|
42
|
+
"nuxt-link-checker": "^4.0.0",
|
|
43
|
+
"nuxt-og-image": "^4.0.0",
|
|
44
|
+
"nuxt-schema-org": "^4.0.0",
|
|
45
|
+
"nuxt-seo-utils": "^6.0.0",
|
|
46
|
+
"nuxt-site-config": "^3.0.4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@antfu/eslint-config": "^
|
|
50
|
-
"@nuxt/module-builder": "^0.
|
|
51
|
-
"@nuxt/schema": "
|
|
52
|
-
"@nuxt/test-utils": "3.
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"bumpp": "^9.
|
|
56
|
-
"eslint": "^
|
|
57
|
-
"execa": "^
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"nuxt
|
|
61
|
-
"typescript": "
|
|
62
|
-
"vitest": "^1.
|
|
49
|
+
"@antfu/eslint-config": "^3.9.2",
|
|
50
|
+
"@nuxt/module-builder": "^0.8.4",
|
|
51
|
+
"@nuxt/schema": "3.14.1592",
|
|
52
|
+
"@nuxt/test-utils": "^3.14.3",
|
|
53
|
+
"@nuxtjs/i18n": "^9.1.0",
|
|
54
|
+
"@vue/test-utils": "^2.4.6",
|
|
55
|
+
"bumpp": "^9.7.1",
|
|
56
|
+
"eslint": "^9.15.0",
|
|
57
|
+
"execa": "^9.5.1",
|
|
58
|
+
"happy-dom": "^15.11.6",
|
|
59
|
+
"nitropack": "^2.10.2",
|
|
60
|
+
"nuxt": "3.14.1592",
|
|
61
|
+
"typescript": "5.6.3",
|
|
62
|
+
"vitest": "^2.1.5"
|
|
63
63
|
},
|
|
64
64
|
"build": {
|
|
65
65
|
"externals": [
|
|
@@ -67,13 +67,28 @@
|
|
|
67
67
|
"consola/utils"
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
|
+
"resolutions": {
|
|
71
|
+
"@nuxt/kit": "3.14.1592",
|
|
72
|
+
"nuxt": "3.14.1592",
|
|
73
|
+
"ofetch": "1.4.1",
|
|
74
|
+
"tailwindcss": "4.0.0-alpha.24",
|
|
75
|
+
"vue": "3.5.12",
|
|
76
|
+
"vue-router": "4.4.5",
|
|
77
|
+
"typescript": "5.6.3"
|
|
78
|
+
},
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"resolutions": {},
|
|
81
|
+
"scripts": {},
|
|
82
|
+
"devDependencies": {}
|
|
83
|
+
},
|
|
70
84
|
"scripts": {
|
|
71
85
|
"build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build",
|
|
72
|
-
"dev": "nuxi dev
|
|
73
|
-
"dev:
|
|
86
|
+
"dev": "nuxi dev playground",
|
|
87
|
+
"dev:docs": "nuxi dev docs",
|
|
88
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
74
89
|
"lint": "eslint . --fix",
|
|
75
90
|
"release": "pnpm build && bumpp && pnpm -r publish --access public",
|
|
76
|
-
"test": "nuxi prepare
|
|
77
|
-
"typecheck": "npx vue-tsc --noEmit --strict"
|
|
91
|
+
"test": " pnpm dev:prepare && nuxi prepare test/fixtures/basic && nuxi prepare test/fixtures/i18n && vitest",
|
|
92
|
+
"typecheck": "pnpm dev:prepare && tsc --noEmit && npx vue-tsc --noEmit --strict"
|
|
78
93
|
}
|
|
79
94
|
}
|
package/dist/module.d.mts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
|
|
3
|
-
interface ModuleOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Will ensure a title is always set by providing a fallback title based on the casing the last slug segment.
|
|
6
|
-
*
|
|
7
|
-
* @default true
|
|
8
|
-
*/
|
|
9
|
-
fallbackTitle?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Will set up a number of defaults for meta tags and Schema.org, if the modules and config are available.
|
|
12
|
-
*
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
automaticDefaults?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* When enabled, it will redirect any request to the canonical domain (site url) using a 301 redirect on non-dev environments.
|
|
18
|
-
*
|
|
19
|
-
* E.g if the site url is 'www.example.com' and the user visits 'example.com',
|
|
20
|
-
* they will be redirected to 'www.example.com'.
|
|
21
|
-
*
|
|
22
|
-
* This is useful for SEO as it prevents duplicate content and consolidates page rank.
|
|
23
|
-
*
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
redirectToCanonicalSiteUrl?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Whether the module should be loaded.
|
|
29
|
-
*/
|
|
30
|
-
enabled: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the debugging mode should be enabled.
|
|
33
|
-
*
|
|
34
|
-
* @default `nuxt.options.debug`
|
|
35
|
-
*/
|
|
36
|
-
debug: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Whether the Nuxt SEO splash should be shown when Nuxt is started.
|
|
39
|
-
*
|
|
40
|
-
* @default `nuxt.options.dev`
|
|
41
|
-
*/
|
|
42
|
-
splash: boolean;
|
|
43
|
-
}
|
|
44
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
45
|
-
|
|
46
|
-
export { type ModuleOptions, _default as default };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, sendRedirect } from "h3";
|
|
2
|
-
import { joinURL } from "ufo";
|
|
3
|
-
import { useNitroOrigin, useSiteConfig } from "#imports";
|
|
4
|
-
export default defineEventHandler((e) => {
|
|
5
|
-
const siteConfig = useSiteConfig(e);
|
|
6
|
-
if (siteConfig.site) {
|
|
7
|
-
const siteConfigHostName = new URL(e.path, siteConfig.site).hostname;
|
|
8
|
-
const origin = useNitroOrigin(e);
|
|
9
|
-
const originHostname = new URL(e.path, origin).hostname;
|
|
10
|
-
if (originHostname !== siteConfigHostName)
|
|
11
|
-
return sendRedirect(e, joinURL(siteConfig.site, e.path), 301);
|
|
12
|
-
}
|
|
13
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function useSchemaOrg(): void;
|
|
2
|
-
export declare function defineWebSite(): void;
|
|
3
|
-
export declare function defineWebPage(): void;
|
|
4
|
-
export declare function useI18n(): {
|
|
5
|
-
t: (_: string, fallback: string) => string;
|
|
6
|
-
te: (_: string) => boolean;
|
|
7
|
-
strategy: string;
|
|
8
|
-
defaultLocale: import("vue").Ref<any>;
|
|
9
|
-
locale: import("vue").Ref<any>;
|
|
10
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
import { useSiteConfig } from "#imports";
|
|
3
|
-
export function useSchemaOrg() {
|
|
4
|
-
}
|
|
5
|
-
export function defineWebSite() {
|
|
6
|
-
}
|
|
7
|
-
export function defineWebPage() {
|
|
8
|
-
}
|
|
9
|
-
export function useI18n() {
|
|
10
|
-
const siteConfig = useSiteConfig();
|
|
11
|
-
return {
|
|
12
|
-
t: (_, fallback) => fallback,
|
|
13
|
-
te: (_) => false,
|
|
14
|
-
strategy: "no_prefix",
|
|
15
|
-
defaultLocale: ref(siteConfig.defaultLocale || "en"),
|
|
16
|
-
locale: ref(siteConfig.currentLocale || siteConfig.defaultLocale || "en")
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import type { NuxtLinkProps } from 'nuxt/app';
|
|
3
|
-
interface NuxtUIBreadcrumbItem extends NuxtLinkProps {
|
|
4
|
-
label: string;
|
|
5
|
-
labelClass?: string;
|
|
6
|
-
icon?: string;
|
|
7
|
-
iconClass?: string;
|
|
8
|
-
as?: string;
|
|
9
|
-
type?: string;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
active?: boolean;
|
|
12
|
-
exact?: boolean;
|
|
13
|
-
exactQuery?: boolean;
|
|
14
|
-
exactMatch?: boolean;
|
|
15
|
-
inactiveClass?: string;
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
}
|
|
18
|
-
export interface BreadcrumbProps {
|
|
19
|
-
/**
|
|
20
|
-
* Generate the breadcrumbs based on a different path than the current route.
|
|
21
|
-
*/
|
|
22
|
-
path?: MaybeRefOrGetter<string>;
|
|
23
|
-
/**
|
|
24
|
-
* The id of the breadcrumb list. It's recommended to provide a unique
|
|
25
|
-
* id when adding multiple breadcrumb lists to the same page.
|
|
26
|
-
*/
|
|
27
|
-
id?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Append additional breadcrumb items to the end of the list. This is applied
|
|
30
|
-
* after the `overrides` option.
|
|
31
|
-
*/
|
|
32
|
-
append?: BreadcrumbItemProps[];
|
|
33
|
-
/**
|
|
34
|
-
* Prepend additional breadcrumb items to the start of the list. This is applied
|
|
35
|
-
* after the `overrides` option.
|
|
36
|
-
*/
|
|
37
|
-
prepend?: BreadcrumbItemProps[];
|
|
38
|
-
/**
|
|
39
|
-
* Override any of the breadcrumb items based on the index.
|
|
40
|
-
*/
|
|
41
|
-
overrides?: (BreadcrumbItemProps | false | undefined)[];
|
|
42
|
-
/**
|
|
43
|
-
* Should the schema.org breadcrumb be generated.
|
|
44
|
-
* @default true
|
|
45
|
-
*/
|
|
46
|
-
schemaOrg?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* The Aria Label for the breadcrumbs.
|
|
49
|
-
* You shouldn't need to change this.
|
|
50
|
-
*
|
|
51
|
-
* @default 'Breadcrumbs'
|
|
52
|
-
*/
|
|
53
|
-
ariaLabel?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Should the current breadcrumb item be shown.
|
|
56
|
-
*
|
|
57
|
-
* @default false
|
|
58
|
-
*/
|
|
59
|
-
hideCurrent?: MaybeRefOrGetter<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* Should the root breadcrumb be shown.
|
|
62
|
-
*/
|
|
63
|
-
hideRoot?: MaybeRefOrGetter<boolean>;
|
|
64
|
-
}
|
|
65
|
-
export interface BreadcrumbItemProps extends NuxtUIBreadcrumbItem {
|
|
66
|
-
/** Whether the breadcrumb item represents the aria-current. */
|
|
67
|
-
current?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* The type of current location the breadcrumb item represents, if `isCurrent` is true.
|
|
70
|
-
* @default 'page'
|
|
71
|
-
*/
|
|
72
|
-
ariaCurrent?: 'page' | 'step' | 'location' | 'date' | 'time' | boolean | 'true' | 'false';
|
|
73
|
-
to?: string;
|
|
74
|
-
ariaLabel?: string;
|
|
75
|
-
separator?: boolean | string;
|
|
76
|
-
class?: (string | string[] | undefined)[] | string;
|
|
77
|
-
/**
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
_props?: {
|
|
81
|
-
first: boolean;
|
|
82
|
-
last: boolean;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
export declare function useBreadcrumbItems(options?: BreadcrumbProps): any;
|
|
86
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { withoutTrailingSlash } from "ufo";
|
|
2
|
-
import { defu } from "defu";
|
|
3
|
-
import { pathBreadcrumbSegments } from "../../pure/breadcrumbs.mjs";
|
|
4
|
-
import {
|
|
5
|
-
computed,
|
|
6
|
-
createSitePathResolver,
|
|
7
|
-
defineBreadcrumb,
|
|
8
|
-
toValue,
|
|
9
|
-
useI18n,
|
|
10
|
-
useRoute,
|
|
11
|
-
useRouter,
|
|
12
|
-
useSchemaOrg,
|
|
13
|
-
withSiteTrailingSlash
|
|
14
|
-
} from "#imports";
|
|
15
|
-
function withoutQuery(path) {
|
|
16
|
-
return path.split("?")[0];
|
|
17
|
-
}
|
|
18
|
-
function titleCase(s) {
|
|
19
|
-
return s.replaceAll("-", " ").replace(/\w\S*/g, (w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase());
|
|
20
|
-
}
|
|
21
|
-
export function useBreadcrumbItems(options = {}) {
|
|
22
|
-
const router = useRouter();
|
|
23
|
-
const routes = router.getRoutes();
|
|
24
|
-
const i18n = useI18n();
|
|
25
|
-
const siteResolver = createSitePathResolver({
|
|
26
|
-
canonical: true,
|
|
27
|
-
absolute: true
|
|
28
|
-
});
|
|
29
|
-
const items = computed(() => {
|
|
30
|
-
let rootNode = "/";
|
|
31
|
-
if (i18n) {
|
|
32
|
-
if (i18n.strategy === "prefix" || i18n.strategy !== "no_prefix" && toValue(i18n.defaultLocale) !== toValue(i18n.locale))
|
|
33
|
-
rootNode = `/${toValue(i18n.locale)}`;
|
|
34
|
-
}
|
|
35
|
-
const current = withoutQuery(withoutTrailingSlash(toValue(options.path || useRoute().path) || rootNode));
|
|
36
|
-
const overrides = options.overrides || [];
|
|
37
|
-
const segments = pathBreadcrumbSegments(current, rootNode).map((path, index) => {
|
|
38
|
-
let item = {
|
|
39
|
-
to: path
|
|
40
|
-
};
|
|
41
|
-
if (typeof overrides[index] !== "undefined") {
|
|
42
|
-
if (overrides[index] === false)
|
|
43
|
-
return false;
|
|
44
|
-
item = defu(overrides[index], item);
|
|
45
|
-
}
|
|
46
|
-
return item;
|
|
47
|
-
});
|
|
48
|
-
if (options.prepend)
|
|
49
|
-
segments.unshift(...options.prepend);
|
|
50
|
-
if (options.append)
|
|
51
|
-
segments.push(...options.append);
|
|
52
|
-
return segments.filter(Boolean).map((item) => {
|
|
53
|
-
const route = routes.find((r) => withoutTrailingSlash(r.path) === withoutTrailingSlash(item.to));
|
|
54
|
-
const routeMeta = route?.meta || {};
|
|
55
|
-
const routeName = route ? String(route.name || route.path) : item.to === "/" ? "index" : "unknown";
|
|
56
|
-
let [name] = routeName.split("___");
|
|
57
|
-
if (name === "unknown")
|
|
58
|
-
name = (item.to || "").split("/").pop() || "";
|
|
59
|
-
if (routeMeta.breadcrumb) {
|
|
60
|
-
item = {
|
|
61
|
-
...item,
|
|
62
|
-
...routeMeta.breadcrumb
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
item.label = item.label || routeMeta.breadcrumbTitle || routeMeta.title;
|
|
66
|
-
if (typeof item.label === "undefined") {
|
|
67
|
-
item.label = item.label || i18n.t(`breadcrumb.items.${name}.label`, name === "index" ? "Home" : titleCase(name), { missingWarn: false });
|
|
68
|
-
item.ariaLabel = item.ariaLabel || i18n.t(`breadcrumb.items.${name}.ariaLabel`, item.label, { missingWarn: false });
|
|
69
|
-
}
|
|
70
|
-
item.ariaLabel = item.ariaLabel || item.label;
|
|
71
|
-
item.current = item.current || item.to === current;
|
|
72
|
-
if (toValue(options.hideCurrent) && item.current)
|
|
73
|
-
return false;
|
|
74
|
-
return item;
|
|
75
|
-
}).map((m) => {
|
|
76
|
-
if (m && m.to) {
|
|
77
|
-
m.to = withSiteTrailingSlash(m.to).value;
|
|
78
|
-
if (m.to === rootNode && toValue(options.hideRoot))
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
return m;
|
|
82
|
-
}).filter(Boolean);
|
|
83
|
-
});
|
|
84
|
-
const schemaOrgEnabled = typeof options.schemaOrg === "undefined" ? true : options.schemaOrg;
|
|
85
|
-
if (process.server && schemaOrgEnabled) {
|
|
86
|
-
useSchemaOrg([
|
|
87
|
-
defineBreadcrumb(computed(() => {
|
|
88
|
-
return {
|
|
89
|
-
id: `#${options.id || "breadcrumb"}`,
|
|
90
|
-
itemListElement: items.value.map((item) => ({
|
|
91
|
-
name: item.label || item.ariaLabel,
|
|
92
|
-
item: item.to ? siteResolver(item.to) : void 0
|
|
93
|
-
}))
|
|
94
|
-
};
|
|
95
|
-
}))
|
|
96
|
-
]);
|
|
97
|
-
}
|
|
98
|
-
return items;
|
|
99
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function applyDefaults(): void;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
createSitePathResolver,
|
|
4
|
-
useHead,
|
|
5
|
-
useRoute,
|
|
6
|
-
useSeoMeta,
|
|
7
|
-
useServerHead,
|
|
8
|
-
useSiteConfig
|
|
9
|
-
} from "#imports";
|
|
10
|
-
export function applyDefaults() {
|
|
11
|
-
const siteConfig = useSiteConfig();
|
|
12
|
-
const route = useRoute();
|
|
13
|
-
const resolveUrl = createSitePathResolver({ withBase: true, absolute: true });
|
|
14
|
-
const canonicalUrl = computed(() => resolveUrl(route.path || "/").value || route.path);
|
|
15
|
-
const minimalPriority = {
|
|
16
|
-
// give nuxt.config values higher priority
|
|
17
|
-
tagPriority: 101
|
|
18
|
-
};
|
|
19
|
-
useHead({
|
|
20
|
-
link: [{ rel: "canonical", href: () => canonicalUrl.value }]
|
|
21
|
-
});
|
|
22
|
-
const locale = siteConfig.currentLocale || siteConfig.defaultLocale;
|
|
23
|
-
if (locale) {
|
|
24
|
-
useServerHead({
|
|
25
|
-
htmlAttrs: { lang: locale }
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
useHead({
|
|
29
|
-
templateParams: { site: siteConfig, siteName: siteConfig.name || "" },
|
|
30
|
-
titleTemplate: "%s %separator %siteName"
|
|
31
|
-
}, minimalPriority);
|
|
32
|
-
const seoMeta = {
|
|
33
|
-
ogType: "website",
|
|
34
|
-
ogUrl: () => canonicalUrl.value,
|
|
35
|
-
ogLocale: locale,
|
|
36
|
-
ogSiteName: siteConfig.name
|
|
37
|
-
};
|
|
38
|
-
if (siteConfig.description)
|
|
39
|
-
seoMeta.description = siteConfig.description;
|
|
40
|
-
if (siteConfig.twitter) {
|
|
41
|
-
const id = siteConfig.twitter.startsWith("@") ? siteConfig.twitter : `@${siteConfig.twitter}`;
|
|
42
|
-
seoMeta.twitterCreator = id;
|
|
43
|
-
seoMeta.twitterSite = id;
|
|
44
|
-
}
|
|
45
|
-
useSeoMeta(seoMeta, minimalPriority);
|
|
46
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { applyDefaults as setup } from "../logic/applyDefaults.mjs";
|
|
2
|
-
import { defineNuxtPlugin } from "#imports";
|
|
3
|
-
export default defineNuxtPlugin({
|
|
4
|
-
name: "nuxt-seo:defaults",
|
|
5
|
-
env: {
|
|
6
|
-
islands: false
|
|
7
|
-
},
|
|
8
|
-
// we need to wait for the i18n plugin to run first
|
|
9
|
-
dependsOn: [
|
|
10
|
-
// @ts-expect-error dynamic
|
|
11
|
-
"nuxt-site-config:i18n"
|
|
12
|
-
],
|
|
13
|
-
setup
|
|
14
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { withoutTrailingSlash } from "ufo";
|
|
2
|
-
import {
|
|
3
|
-
computed,
|
|
4
|
-
defineNuxtPlugin,
|
|
5
|
-
useHead,
|
|
6
|
-
useRoute
|
|
7
|
-
} from "#imports";
|
|
8
|
-
function titleCase(s) {
|
|
9
|
-
return s.replaceAll("-", " ").replace(/\w\S*/g, (w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase());
|
|
10
|
-
}
|
|
11
|
-
export default defineNuxtPlugin({
|
|
12
|
-
name: "nuxt-seo:fallback-titles",
|
|
13
|
-
env: {
|
|
14
|
-
islands: false
|
|
15
|
-
},
|
|
16
|
-
setup() {
|
|
17
|
-
const route = useRoute();
|
|
18
|
-
const title = computed(() => {
|
|
19
|
-
if (typeof route.meta?.title === "string")
|
|
20
|
-
return route.meta?.title;
|
|
21
|
-
const path = withoutTrailingSlash(route.path || "/");
|
|
22
|
-
const lastSegment = path.split("/").pop();
|
|
23
|
-
return lastSegment ? titleCase(lastSegment) : null;
|
|
24
|
-
});
|
|
25
|
-
const minimalPriority = {
|
|
26
|
-
// give nuxt.config values higher priority
|
|
27
|
-
tagPriority: 101
|
|
28
|
-
};
|
|
29
|
-
useHead({ title: () => title.value }, minimalPriority);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function pathBreadcrumbSegments(path: string, rootNode?: string): string[];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { hasTrailingSlash, parseURL, stringifyParsedURL, withTrailingSlash } from "ufo";
|
|
2
|
-
export function pathBreadcrumbSegments(path, rootNode = "/") {
|
|
3
|
-
const startNode = parseURL(path);
|
|
4
|
-
const appendsTrailingSlash = hasTrailingSlash(startNode.pathname);
|
|
5
|
-
const stepNode = (node, nodes = []) => {
|
|
6
|
-
const fullPath = stringifyParsedURL(node);
|
|
7
|
-
const currentPathName = node.pathname || "/";
|
|
8
|
-
nodes.push(fullPath || "/");
|
|
9
|
-
if (currentPathName !== rootNode && currentPathName !== "/") {
|
|
10
|
-
node.pathname = currentPathName.substring(0, currentPathName.lastIndexOf("/"));
|
|
11
|
-
if (appendsTrailingSlash)
|
|
12
|
-
node.pathname = withTrailingSlash(node.pathname.substring(0, node.pathname.lastIndexOf("/")));
|
|
13
|
-
stepNode(node, nodes);
|
|
14
|
-
}
|
|
15
|
-
return nodes;
|
|
16
|
-
};
|
|
17
|
-
return stepNode(startNode).reverse();
|
|
18
|
-
}
|