@nuxtjs/seo 2.0.0-rc.1 → 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 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
- - 📖 [nuxt-simple-sitemap](https://github.com/nuxt-modules/sitemap) - Sitemap.xml Support
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
@@ -5,5 +5,5 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "seo",
8
- "version": "2.0.0-rc.1"
8
+ "version": "2.0.0-rc.2"
9
9
  }
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.1";
5
+ const version = "2.0.0-rc.2";
6
6
 
7
7
  const Modules = [
8
8
  "nuxt-simple-robots",
9
- "nuxt-simple-sitemap",
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.value !== i18n.locale.value)
27
- rootNode = `/${i18n.defaultLocale.value}`;
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
- return pathBreadcrumbSegments(current, rootNode).map((path) => ({
31
- to: path
32
- })).map((item) => {
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
- if (process.server && options.schemaOrg) {
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.1",
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": {
@@ -19,27 +19,36 @@
19
19
  "bugs": {
20
20
  "url": "https://github.com/harlan-zw/nuxt-seo/issues"
21
21
  },
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/types.d.ts",
25
+ "import": "./dist/module.mjs",
26
+ "require": "./dist/module.cjs"
27
+ }
28
+ },
29
+ "main": "./dist/module.cjs",
30
+ "types": "./dist/types.d.ts",
22
31
  "files": [
23
32
  "dist"
24
33
  ],
25
34
  "dependencies": {
26
- "@nuxt/kit": "^3.9.0",
35
+ "@nuxt/kit": "^3.9.1",
36
+ "@nuxtjs/sitemap": "^5.0.1",
27
37
  "chalk": "^5.3.0",
28
- "defu": "^6.1.3",
29
- "nuxt-link-checker": "^3.0.0-rc.3",
30
- "nuxt-og-image": "^3.0.0-rc.21",
31
- "nuxt-schema-org": "^3.3.0",
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",
32
42
  "nuxt-seo-experiments": "^4.0.0-rc.0",
33
- "nuxt-simple-robots": "^4.0.0-rc.9",
34
- "nuxt-simple-sitemap": "^4.4.1",
35
- "nuxt-site-config": "^2.2.0",
36
- "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",
37
46
  "ufo": "^1.3.2"
38
47
  },
39
48
  "devDependencies": {
40
49
  "@antfu/eslint-config": "^2.6.1",
41
50
  "@nuxt/module-builder": "^0.5.5",
42
- "@nuxt/schema": "^3.9.0",
51
+ "@nuxt/schema": "^3.9.1",
43
52
  "@nuxt/test-utils": "3.9.0",
44
53
  "@nuxt/ui": "^2.11.1",
45
54
  "@nuxtjs/i18n": "8.0.0",
@@ -47,16 +56,17 @@
47
56
  "eslint": "^8.56.0",
48
57
  "execa": "^8.0.1",
49
58
  "nitropack": "^2.8.1",
50
- "nuxt": "^3.9.0",
59
+ "nuxt": "^3.9.1",
60
+ "nuxt-icon": "^0.6.8",
51
61
  "typescript": "^5.3.3",
52
- "vitest": "^1.1.1"
62
+ "vitest": "^1.1.3"
53
63
  },
54
64
  "scripts": {
55
65
  "build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build",
56
66
  "dev": "nuxi dev .playground",
57
67
  "lint": "eslint . --fix",
58
- "release": "bumpp && pnpm -r publish --access public",
59
- "test": "nuxi prepare .playground && true",
68
+ "release": "pnpm build && bumpp && pnpm -r publish --access public",
69
+ "test": "nuxi prepare .playground && vitest",
60
70
  "typecheck": "tsc --noEmit --strict"
61
71
  }
62
72
  }