nuxt-seo-utils 5.0.0 → 5.0.2

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/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "nuxt": ">=3.6.1",
6
6
  "bridge": false
7
7
  },
8
- "version": "4.0.1",
8
+ "version": "5.0.1",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.4",
11
11
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -427,8 +427,9 @@ const module = defineNuxtModule({
427
427
  });
428
428
  }
429
429
  }
430
+ const hasI18n = hasNuxtModule("@nuxtjs/i18n") || hasNuxtModule("nuxt-i18n-micro");
430
431
  if (config.automaticDefaults) {
431
- if (hasNuxtModule("@nuxtjs/i18n")) {
432
+ if (hasI18n) {
432
433
  addPlugin({
433
434
  src: resolve(`./runtime/nuxt/plugins/defaultsWaitI18n`)
434
435
  });
@@ -443,7 +444,7 @@ const module = defineNuxtModule({
443
444
  src: resolve("./runtime/nuxt/plugins/titles")
444
445
  });
445
446
  }
446
- if (!hasNuxtModule("@nuxtjs/i18n")) {
447
+ if (!hasI18n) {
447
448
  addImports({
448
449
  from: resolve(`./runtime/nuxt/composables/polyfills`),
449
450
  name: "useI18n"
@@ -475,6 +476,7 @@ const module = defineNuxtModule({
475
476
  middleware: true
476
477
  });
477
478
  }
479
+ nuxt.options.alias["#seo-utils"] = resolve("./runtime");
478
480
  nuxt.options.runtimeConfig.public["nuxt-seo"] = {
479
481
  canonicalQueryWhitelist: config.canonicalQueryWhitelist || [
480
482
  "page",
@@ -29,16 +29,16 @@ export interface BreadcrumbProps {
29
29
  * Append additional breadcrumb items to the end of the list. This is applied
30
30
  * after the `overrides` option.
31
31
  */
32
- append?: BreadcrumbItemProps[];
32
+ append?: MaybeRefOrGetter<BreadcrumbItemProps[]>;
33
33
  /**
34
34
  * Prepend additional breadcrumb items to the start of the list. This is applied
35
35
  * after the `overrides` option.
36
36
  */
37
- prepend?: BreadcrumbItemProps[];
37
+ prepend?: MaybeRefOrGetter<BreadcrumbItemProps[]>;
38
38
  /**
39
39
  * Override any of the breadcrumb items based on the index.
40
40
  */
41
- overrides?: (BreadcrumbItemProps | false | undefined)[];
41
+ overrides?: MaybeRefOrGetter<(BreadcrumbItemProps | false | undefined)[]>;
42
42
  /**
43
43
  * Should the schema.org breadcrumb be generated.
44
44
  * @default true
@@ -33,7 +33,7 @@ export function useBreadcrumbItems(options = {}) {
33
33
  rootNode = `/${toValue(i18n.locale)}`;
34
34
  }
35
35
  const current = withoutQuery(withoutTrailingSlash(toValue(options.path || router.currentRoute.value?.path) || rootNode));
36
- const overrides = options.overrides || [];
36
+ const overrides = toValue(options.overrides) || [];
37
37
  const segments = pathBreadcrumbSegments(current, rootNode).map((path, index) => {
38
38
  let item = {
39
39
  to: path
@@ -46,29 +46,22 @@ export function useBreadcrumbItems(options = {}) {
46
46
  return item;
47
47
  });
48
48
  if (options.prepend)
49
- segments.unshift(...options.prepend);
49
+ segments.unshift(...toValue(options.prepend));
50
50
  if (options.append)
51
- segments.push(...options.append);
51
+ segments.push(...toValue(options.append));
52
52
  return segments.filter(Boolean).map((item) => {
53
53
  const route = router.resolve(item.to)?.matched?.[0] || router.currentRoute.value;
54
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" || name.includes("/"))
58
- name = (item.to || "").split("/").pop() || "";
55
+ const routeName = route ? String(route.name.split("___")) : item.to === "/" ? "index" : null;
56
+ const fallbackLabel = titleCase(routeName === "index" ? "Home" : (item.to || "").split("/").pop() || "");
59
57
  if (routeMeta.breadcrumb) {
60
58
  item = {
61
59
  ...item,
62
60
  ...routeMeta.breadcrumb
63
61
  };
64
62
  }
65
- item.label = item.label || routeMeta.breadcrumbTitle || routeMeta.title;
66
- if (typeof item.label === "undefined") {
67
- item.label = i18n.t(`breadcrumb.items.${name}.label`, name === "index" ? "Home" : titleCase(name), { missingWarn: false });
68
- }
69
- if (typeof item.ariaLabel === "undefined") {
70
- item.ariaLabel = i18n.t(`breadcrumb.items.${name}.ariaLabel`, item.label, { missingWarn: false }) || item.label;
71
- }
63
+ item.label = item.label || routeMeta.title || routeMeta.breadcrumbTitle || i18n.t(`breadcrumb.items.${routeName}.label`, fallbackLabel, { missingWarn: false });
64
+ item.ariaLabel = item.ariaLabel || i18n.t(`breadcrumb.items.${routeName}.ariaLabel`, item.label, { missingWarn: false }) || item.label;
72
65
  item.current = item.current || item.to === current;
73
66
  if (toValue(options.hideCurrent) && item.current)
74
67
  return false;
@@ -17,6 +17,8 @@ export default defineNuxtPlugin(() => {
17
17
  };
18
18
  if (siteConfig.separator)
19
19
  input.templateParams.separator = siteConfig.separator;
20
+ if (siteConfig.titleSeparator)
21
+ input.templateParams.titleSeparator = siteConfig.titleSeparator;
20
22
  if (siteConfig.description) {
21
23
  input.templateParams.siteDescription = siteConfig.description;
22
24
  input.meta.push(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-seo-utils",
3
3
  "type": "module",
4
- "version": "5.0.0",
4
+ "version": "5.0.2",
5
5
  "description": "SEO utilities to improve your Nuxt sites discoverability and shareability",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@nuxt/kit": "^3.13.2",
36
- "@unhead/addons": "^1.11.7",
36
+ "@unhead/addons": "^1.11.10",
37
37
  "defu": "^6.1.4",
38
38
  "escape-string-regexp": "^5.0.0",
39
39
  "fast-glob": "^3.3.2",
@@ -45,26 +45,26 @@
45
45
  "ufo": "^1.5.4"
46
46
  },
47
47
  "devDependencies": {
48
- "@antfu/eslint-config": "3.7.3",
48
+ "@antfu/eslint-config": "3.8.0",
49
49
  "@nuxt/module-builder": "^0.8.4",
50
- "@nuxt/test-utils": "^3.14.2",
51
- "@nuxt/ui": "^2.18.6",
50
+ "@nuxt/test-utils": "^3.14.4",
51
+ "@nuxt/ui": "^2.18.7",
52
52
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
53
53
  "@nuxtjs/i18n": "^8.5.5",
54
- "@unhead/shared": "^1.11.7",
54
+ "@unhead/shared": "^1.11.10",
55
55
  "@vue/test-utils": "^2.4.6",
56
- "bumpp": "^9.6.1",
56
+ "bumpp": "^9.8.0",
57
57
  "case-police": "^0.7.0",
58
58
  "cheerio": "1.0.0",
59
- "eslint": "^9.11.1",
59
+ "eslint": "^9.13.0",
60
60
  "happy-dom": "^15.7.4",
61
61
  "markdownlint-cli": "^0.42.0",
62
62
  "nuxt": "^3.13.2",
63
63
  "nuxt-content-twoslash": "^0.1.1",
64
- "playwright-core": "^1.47.2",
65
- "sass": "^1.79.4",
66
- "typescript": "5.6.2",
67
- "vitest": "^2.1.2"
64
+ "playwright-core": "^1.48.2",
65
+ "sass": "^1.80.5",
66
+ "typescript": "5.6.3",
67
+ "vitest": "^2.1.4"
68
68
  },
69
69
  "scripts": {
70
70
  "lint": "eslint . --fix",