nuxt-seo-utils 6.0.7 → 6.0.8

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": "6.0.6",
8
+ "version": "6.0.7",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.4",
11
11
  "unbuild": "2.0.0"
@@ -49,18 +49,27 @@ export function useBreadcrumbItems(options = {}) {
49
49
  if (options.append)
50
50
  segments.push(...toValue(options.append));
51
51
  return segments.filter(Boolean).map((item) => {
52
- const route = router.resolve(item.to)?.matched?.[0] || router.currentRoute.value;
53
- const routeMeta = route?.meta || {};
54
- const routeName = route ? String(route.name?.split("___")[0]) : item.to === "/" ? "index" : null;
55
- const fallbackLabel = titleCase(routeName === "index" ? "Home" : (item.to || "").split("/").pop() || "");
56
- if (routeMeta.breadcrumb) {
57
- item = {
58
- ...item,
59
- ...routeMeta.breadcrumb
60
- };
52
+ let fallbackLabel = titleCase(String((item.to || "").split("/").pop()));
53
+ let fallbackAriaLabel = "";
54
+ const route = router.resolve(item.to)?.matched?.[0];
55
+ if (route) {
56
+ const routeMeta = route?.meta || {};
57
+ if (routeMeta.breadcrumb) {
58
+ item = {
59
+ ...item,
60
+ ...routeMeta.breadcrumb
61
+ };
62
+ }
63
+ const routeName = String(route.name).split("___")[0];
64
+ if (routeName === "index") {
65
+ fallbackLabel = "Home";
66
+ }
67
+ fallbackLabel = routeMeta.breadcrumbLabel || routeMeta.breadcrumbTitle || routeMeta.title || fallbackLabel;
68
+ fallbackLabel = i18n.t(`breadcrumb.items.${routeName}.label`, fallbackLabel, { missingWarn: true });
69
+ fallbackAriaLabel = i18n.t(`breadcrumb.items.${routeName}.ariaLabel`, fallbackAriaLabel, { missingWarn: false });
61
70
  }
62
- item.label = item.label || routeMeta.title || routeMeta.breadcrumbTitle || i18n.t(`breadcrumb.items.${routeName}.label`, fallbackLabel, { missingWarn: false });
63
- item.ariaLabel = item.ariaLabel || i18n.t(`breadcrumb.items.${routeName}.ariaLabel`, item.label, { missingWarn: false }) || item.label;
71
+ item.label = item.label || fallbackLabel;
72
+ item.ariaLabel = item.ariaLabel || fallbackAriaLabel || item.label;
64
73
  item.current = item.current || item.to === current;
65
74
  if (toValue(options.hideCurrent) && item.current)
66
75
  return false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-seo-utils",
3
3
  "type": "module",
4
- "version": "6.0.7",
4
+ "version": "6.0.8",
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",