nuxt-seo-utils 6.0.6 → 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
|
@@ -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
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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 ||
|
|
63
|
-
item.ariaLabel = item.ariaLabel ||
|
|
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;
|
|
@@ -6,13 +6,16 @@ export default defineEventHandler((e) => {
|
|
|
6
6
|
if (path.startsWith("/_nuxt") || path.startsWith("/api")) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
+
if (path.split("/").pop()?.includes(".")) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
9
12
|
const siteConfig = useSiteConfig(e);
|
|
10
13
|
if (!siteConfig.url) {
|
|
11
14
|
return;
|
|
12
15
|
}
|
|
13
16
|
const siteConfigHostName = new URL(e.path, siteConfig.url).host;
|
|
14
17
|
const host = getRequestHost(e, { xForwardedHost: true });
|
|
15
|
-
if (e.headers.get("x-nuxt-seo-redirected")) {
|
|
18
|
+
if (e.headers.get("x-nuxt-seo-redirected") || host.includes("http") || host.replace("https://", "").includes(":")) {
|
|
16
19
|
return;
|
|
17
20
|
}
|
|
18
21
|
if (host.split(":")[0] !== siteConfigHostName.split(":")[0]) {
|
package/package.json
CHANGED