@nuxtjs/seo 2.0.0-rc.2 → 2.0.0-rc.3
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 +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/nuxt/composables/useBreadcrumbItems.d.ts +25 -0
- package/dist/runtime/nuxt/composables/useBreadcrumbItems.mjs +22 -6
- package/dist/runtime/nuxt/plugin/defaults.mjs +1 -1
- package/package.json +16 -15
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ With powerful APIs built for fully dynamic sites and zero-config defaults for st
|
|
|
38
38
|
|
|
39
39
|
## Modules
|
|
40
40
|
|
|
41
|
-
- 📖 [
|
|
41
|
+
- 📖 [@nuxtjs/sitemap](https://github.com/nuxt-modules/sitemap) - Sitemap.xml Support
|
|
42
42
|
- 🤖 [nuxt-simple-robots](https://github.com/harlan-zw/nuxt-simple-robots) - Manage site crawling
|
|
43
43
|
- 🔎 [nuxt-schema-org](https://unhead-schema-org.harlanzw.com/) - Generate Schema.org JSON-LD for SEO
|
|
44
44
|
- △ [nuxt-seo-experiments](https://github.com/harlan-zw/nuxt-seo-experiments) - Experimental SEO meta features
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { defineNuxtModule, useLogger, createResolver, installModule, addPlugin,
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { installNuxtSiteConfig } from 'nuxt-site-config-kit';
|
|
4
4
|
|
|
5
|
-
const version = "2.0.0-rc.
|
|
5
|
+
const version = "2.0.0-rc.2";
|
|
6
6
|
|
|
7
7
|
const Modules = [
|
|
8
8
|
"nuxt-simple-robots",
|
|
9
|
-
"
|
|
9
|
+
"@nuxtjs/sitemap",
|
|
10
10
|
"nuxt-og-image",
|
|
11
11
|
"nuxt-schema-org",
|
|
12
12
|
"nuxt-seo-experiments",
|
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
import type { MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import type { BreadcrumbLink } from '@nuxt/ui/dist/runtime/types';
|
|
3
3
|
export interface BreadcrumbProps {
|
|
4
|
+
/**
|
|
5
|
+
* Generate the breadcrumbs based on a different path than the current route.
|
|
6
|
+
*/
|
|
4
7
|
path?: MaybeRefOrGetter<string>;
|
|
8
|
+
/**
|
|
9
|
+
* The id of the breadcrumb list. It's recommended to provide a unique
|
|
10
|
+
* id when adding multiple breadcrumb lists to the same page.
|
|
11
|
+
*/
|
|
5
12
|
id?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Append additional breadcrumb items to the end of the list. This is applied
|
|
15
|
+
* after the `overrides` option.
|
|
16
|
+
*/
|
|
17
|
+
append?: BreadcrumbItemProps[];
|
|
18
|
+
/**
|
|
19
|
+
* Prepend additional breadcrumb items to the start of the list. This is applied
|
|
20
|
+
* after the `overrides` option.
|
|
21
|
+
*/
|
|
22
|
+
prepend?: BreadcrumbItemProps[];
|
|
23
|
+
/**
|
|
24
|
+
* Override any of the breadcrumb items based on the index.
|
|
25
|
+
*/
|
|
26
|
+
overrides?: (BreadcrumbItemProps | false | undefined)[];
|
|
27
|
+
/**
|
|
28
|
+
* Should the schema.org breadcrumb be generated.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
6
31
|
schemaOrg?: boolean;
|
|
7
32
|
/**
|
|
8
33
|
* The Aria Label for the breadcrumbs.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { withoutTrailingSlash } from "ufo";
|
|
2
|
+
import { defu } from "defu";
|
|
2
3
|
import { pathBreadcrumbSegments } from "../../pure/breadcrumbs.mjs";
|
|
3
4
|
import {
|
|
4
5
|
computed,
|
|
@@ -23,13 +24,27 @@ export function useBreadcrumbItems(options = {}) {
|
|
|
23
24
|
const items = computed(() => {
|
|
24
25
|
let rootNode = "/";
|
|
25
26
|
if (i18n) {
|
|
26
|
-
if (i18n.strategy === "prefix" || i18n.strategy !== "no_prefix" && i18n.defaultLocale
|
|
27
|
-
rootNode = `/${i18n.
|
|
27
|
+
if (i18n.strategy === "prefix" || i18n.strategy !== "no_prefix" && toValue(i18n.defaultLocale) !== toValue(i18n.locale))
|
|
28
|
+
rootNode = `/${toValue(i18n.locale)}`;
|
|
28
29
|
}
|
|
29
30
|
const current = withoutQuery(withoutTrailingSlash(toValue(options.path || useRoute().path) || rootNode));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const overrides = options.overrides || [];
|
|
32
|
+
const segments = pathBreadcrumbSegments(current, rootNode).map((path, index) => {
|
|
33
|
+
let item = {
|
|
34
|
+
to: path
|
|
35
|
+
};
|
|
36
|
+
if (typeof overrides[index] !== "undefined") {
|
|
37
|
+
if (overrides[index] === false)
|
|
38
|
+
return false;
|
|
39
|
+
item = defu(overrides[index], item);
|
|
40
|
+
}
|
|
41
|
+
return item;
|
|
42
|
+
});
|
|
43
|
+
if (options.prepend)
|
|
44
|
+
segments.unshift(...options.prepend);
|
|
45
|
+
if (options.append)
|
|
46
|
+
segments.push(...options.append);
|
|
47
|
+
return segments.filter(Boolean).map((item) => {
|
|
33
48
|
const route = routes.find((r) => withoutTrailingSlash(r.path) === withoutTrailingSlash(item.to));
|
|
34
49
|
const routeMeta = route?.meta || {};
|
|
35
50
|
const routeName = route ? String(route.name || route.path) : item.to === "/" ? "index" : "unknown";
|
|
@@ -61,7 +76,8 @@ export function useBreadcrumbItems(options = {}) {
|
|
|
61
76
|
return m;
|
|
62
77
|
}).filter(Boolean);
|
|
63
78
|
});
|
|
64
|
-
|
|
79
|
+
const schemaOrgEnabled = typeof options.schemaOrg === "undefined" ? true : options.schemaOrg;
|
|
80
|
+
if (process.server && schemaOrgEnabled) {
|
|
65
81
|
useSchemaOrg([
|
|
66
82
|
defineBreadcrumb(computed(() => {
|
|
67
83
|
return {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
export default defineNuxtPlugin({
|
|
12
12
|
name: "nuxt-seo:defaults",
|
|
13
13
|
setup() {
|
|
14
|
-
const siteConfig = useSiteConfig()
|
|
14
|
+
const siteConfig = useSiteConfig();
|
|
15
15
|
const route = useRoute();
|
|
16
16
|
const resolveUrl = createSitePathResolver({ withBase: true, absolute: true });
|
|
17
17
|
const canonicalUrl = computed(() => resolveUrl(route.path || "/").value || route.path);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/seo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.3",
|
|
5
5
|
"packageManager": "pnpm@8.14.0",
|
|
6
6
|
"description": "The all-in-one SEO layer for Nuxt 3.",
|
|
7
7
|
"author": {
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nuxt/kit": "^3.9.
|
|
35
|
+
"@nuxt/kit": "^3.9.1",
|
|
36
|
+
"@nuxtjs/sitemap": "^5.0.1",
|
|
36
37
|
"chalk": "^5.3.0",
|
|
37
|
-
"defu": "^6.1.
|
|
38
|
-
"nuxt-link-checker": "^3.0.0-rc.
|
|
39
|
-
"nuxt-og-image": "
|
|
40
|
-
"nuxt-schema-org": "^3.3.
|
|
38
|
+
"defu": "^6.1.4",
|
|
39
|
+
"nuxt-link-checker": "^3.0.0-rc.4",
|
|
40
|
+
"nuxt-og-image": "3.0.0-rc.23",
|
|
41
|
+
"nuxt-schema-org": "^3.3.2",
|
|
41
42
|
"nuxt-seo-experiments": "^4.0.0-rc.0",
|
|
42
|
-
"nuxt-simple-robots": "^4.0.0-rc.
|
|
43
|
-
"nuxt-
|
|
44
|
-
"nuxt-site-config": "^2.2.
|
|
45
|
-
"nuxt-site-config-kit": "^2.2.0",
|
|
43
|
+
"nuxt-simple-robots": "^4.0.0-rc.10",
|
|
44
|
+
"nuxt-site-config": "^2.2.3",
|
|
45
|
+
"nuxt-site-config-kit": "^2.2.3",
|
|
46
46
|
"ufo": "^1.3.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@antfu/eslint-config": "^2.6.1",
|
|
50
50
|
"@nuxt/module-builder": "^0.5.5",
|
|
51
|
-
"@nuxt/schema": "^3.9.
|
|
51
|
+
"@nuxt/schema": "^3.9.1",
|
|
52
52
|
"@nuxt/test-utils": "3.9.0",
|
|
53
53
|
"@nuxt/ui": "^2.11.1",
|
|
54
54
|
"@nuxtjs/i18n": "8.0.0",
|
|
@@ -56,16 +56,17 @@
|
|
|
56
56
|
"eslint": "^8.56.0",
|
|
57
57
|
"execa": "^8.0.1",
|
|
58
58
|
"nitropack": "^2.8.1",
|
|
59
|
-
"nuxt": "^3.9.
|
|
59
|
+
"nuxt": "^3.9.1",
|
|
60
|
+
"nuxt-icon": "^0.6.8",
|
|
60
61
|
"typescript": "^5.3.3",
|
|
61
|
-
"vitest": "^1.1.
|
|
62
|
+
"vitest": "^1.1.3"
|
|
62
63
|
},
|
|
63
64
|
"scripts": {
|
|
64
65
|
"build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build",
|
|
65
66
|
"dev": "nuxi dev .playground",
|
|
66
67
|
"lint": "eslint . --fix",
|
|
67
|
-
"release": "bumpp && pnpm -r publish --access public",
|
|
68
|
-
"test": "nuxi prepare .playground &&
|
|
68
|
+
"release": "pnpm build && bumpp && pnpm -r publish --access public",
|
|
69
|
+
"test": "nuxi prepare .playground && vitest",
|
|
69
70
|
"typecheck": "tsc --noEmit --strict"
|
|
70
71
|
}
|
|
71
72
|
}
|