nuxt-seo-utils 7.0.9 → 7.0.11

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.16.0",
6
6
  "bridge": false
7
7
  },
8
- "version": "7.0.8",
8
+ "version": "7.0.10",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "1.0.1",
11
11
  "unbuild": "3.5.0"
package/dist/module.mjs CHANGED
@@ -83,11 +83,13 @@ const MetaTagFileGlobs = [
83
83
  "**/*og-image.{png,jpg,jpeg,gif}",
84
84
  "**/*opengraph-image.{png,jpg,jpeg,gif}",
85
85
  "**/*twitter-image.{png,jpg,jpeg,gif}",
86
- "**/*icon.{ico,jpg,jpeg,png,svg}",
87
- "**/*icon-*.{ico,jpg,jpeg,png,svg}",
88
86
  "**/*apple-icon.{jpg,jpeg,png}",
89
87
  "**/*apple-touch.{jpg,jpeg,png}",
90
- "**/*apple-touch-icon.{jpg,jpeg,png}"
88
+ "**/*apple-touch-*.{jpg,jpeg,png}",
89
+ "**/*apple-touch-icon.{jpg,jpeg,png}",
90
+ "**/*apple-touch-icon-*.{jpg,jpeg,png}",
91
+ "**/*icon.{ico,jpg,jpeg,png,svg}",
92
+ "**/*icon-*.{ico,jpg,jpeg,png,svg}"
91
93
  ];
92
94
 
93
95
  function generateNuxtPageFromFile(file, pagesDir) {
@@ -303,7 +305,7 @@ async function generateTagsFromPublicFiles(nuxt = useNuxt()) {
303
305
  });
304
306
  }
305
307
  const isIcon = (file) => file.includes("icon") && !file.endsWith(".ico");
306
- const isAppleTouchIcon = (file) => file.startsWith("apple-icon.") || file.startsWith("apple-touch-icon.") || file.startsWith("apple-touch.");
308
+ const isAppleTouchIcon = (file) => file.includes("apple-icon") || file.includes("apple-touch-icon") || file.includes("apple-touch");
307
309
  headConfig.link.push(
308
310
  ...await Promise.all([
309
311
  ...rootPublicFiles.filter((file) => isIcon(file) && !isAppleTouchIcon(file)).sort().map(async (iconFile) => {
@@ -61,6 +61,14 @@ export interface BreadcrumbProps {
61
61
  * Should the root breadcrumb be shown.
62
62
  */
63
63
  hideRoot?: MaybeRefOrGetter<boolean>;
64
+ /**
65
+ * Should breadcrumb items with non-existing path be shown.
66
+ *
67
+ * By default, every path segments will be present in breadcrumb list even if there is no corresponding page for such segment.
68
+ *
69
+ * @default false
70
+ */
71
+ hideNonExisting?: MaybeRefOrGetter<boolean>;
64
72
  /**
65
73
  * The root segment of the breadcrumb list.
66
74
  *
@@ -28,11 +28,12 @@ const BreadcrumbCtx = Symbol("BreadcrumbCtx");
28
28
  export function useBreadcrumbItems(_options = {}) {
29
29
  const nuxtApp = useNuxtApp();
30
30
  const vm = getCurrentInstance();
31
- const id = `${vm?.uid || 0}:${_options.id || "breadcrumb"}`;
31
+ const id = `${_options.id || "breadcrumb"}`;
32
+ const uid = `${vm?.uid || 0}`;
32
33
  const parentChain = [];
33
34
  let parent = vm?.parent;
34
35
  while (parent) {
35
- parentChain.push(parent.uid);
36
+ parentChain.push(parent.uid || 0);
36
37
  parent = parent.parent;
37
38
  }
38
39
  const pauseUpdates = ref(import.meta.client && nuxtApp.isHydrating);
@@ -44,11 +45,11 @@ export function useBreadcrumbItems(_options = {}) {
44
45
  provide(BreadcrumbCtx, stateRef);
45
46
  }
46
47
  const state = stateRef.value;
47
- state[id] = _options;
48
+ state[uid] = _options;
48
49
  stateRef.value = state;
49
50
  onUnmounted(() => {
50
51
  const state2 = toRaw(stateRef.value);
51
- delete state2[id];
52
+ delete state2[uid];
52
53
  stateRef.value = state2;
53
54
  });
54
55
  if (import.meta.client) {
@@ -87,7 +88,7 @@ export function useBreadcrumbItems(_options = {}) {
87
88
  return lastBreadcrumbs.value;
88
89
  }
89
90
  const state = toValue(stateRef) || {};
90
- const optionStack = [...parentChain, vm?.uid || 0].map((parentId) => state[`${parentId}:${_options.id || "breadcrumb"}`]).filter(Boolean);
91
+ const optionStack = [...parentChain, uid].map((parentId) => state[parentId]).filter(Boolean);
91
92
  const flatOptions = optionStack.reduce((acc, _cur) => {
92
93
  const cur = {};
93
94
  Object.entries(_cur).forEach(([key, value]) => {
@@ -95,6 +96,7 @@ export function useBreadcrumbItems(_options = {}) {
95
96
  });
96
97
  acc.hideRoot = typeof cur.hideRoot === "undefined" ? acc.hideRoot : cur.hideRoot;
97
98
  acc.hideCurrent = typeof cur.hideCurrent === "undefined" ? acc.hideCurrent : cur.hideCurrent;
99
+ acc.hideNonExisting = typeof cur.hideNonExisting === "undefined" ? acc.hideNonExisting : cur.hideNonExisting;
98
100
  acc.rootSegment = acc.rootSegment || cur.rootSegment;
99
101
  acc.path = acc.path || cur.path;
100
102
  acc.overrides = acc.overrides || [];
@@ -154,6 +156,8 @@ export function useBreadcrumbItems(_options = {}) {
154
156
  fallbackLabel = routeMeta.breadcrumbLabel || routeMeta.breadcrumbTitle || routeMeta.title || fallbackLabel;
155
157
  fallbackLabel = i18n.t(`breadcrumb.items.${routeName}.label`, fallbackLabel, { missingWarn: false });
156
158
  fallbackAriaLabel = i18n.t(`breadcrumb.items.${routeName}.ariaLabel`, fallbackAriaLabel, { missingWarn: false });
159
+ } else if (flatOptions.hideNonExisting) {
160
+ return false;
157
161
  }
158
162
  item.label = item.label || fallbackLabel;
159
163
  item.ariaLabel = item.ariaLabel || fallbackAriaLabel || item.label;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-seo-utils",
3
3
  "type": "module",
4
- "version": "7.0.9",
4
+ "version": "7.0.11",
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",
@@ -32,8 +32,8 @@
32
32
  ]
33
33
  },
34
34
  "dependencies": {
35
- "@nuxt/kit": "^3.16.2",
36
- "@unhead/addons": "^2.0.7",
35
+ "@nuxt/kit": "^3.17.1",
36
+ "@unhead/addons": "^2.0.8",
37
37
  "defu": "^6.1.4",
38
38
  "escape-string-regexp": "^5.0.0",
39
39
  "fast-glob": "^3.3.3",
@@ -46,29 +46,29 @@
46
46
  "ufo": "^1.6.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@antfu/eslint-config": "4.11.0",
49
+ "@antfu/eslint-config": "^4.12.0",
50
50
  "@nuxt/module-builder": "^1.0.1",
51
- "@nuxt/schema": "3.16.2",
52
- "@nuxt/test-utils": "^3.17.2",
53
- "@nuxt/ui": "^3.0.2",
51
+ "@nuxt/schema": "^3.17.1",
52
+ "@nuxt/test-utils": "^3.18.0",
53
+ "@nuxt/ui": "^3.1.1",
54
54
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
55
- "@nuxtjs/i18n": "^9.5.3",
56
- "@types/node": "^22.14.1",
57
- "@unhead/vue": "2.0.4",
55
+ "@nuxtjs/i18n": "^9.5.4",
56
+ "@types/node": "^22.15.3",
57
+ "@unhead/vue": "^2.0.8",
58
58
  "@vue/test-utils": "^2.4.6",
59
59
  "bumpp": "^10.1.0",
60
60
  "case-police": "^2.0.0",
61
61
  "cheerio": "1.0.0",
62
- "eslint": "^9.24.0",
63
- "happy-dom": "^17.4.4",
62
+ "eslint": "^9.26.0",
63
+ "happy-dom": "^17.4.6",
64
64
  "markdownlint-cli": "^0.44.0",
65
- "nuxt": "3.16.2",
65
+ "nuxt": "^3.17.1",
66
66
  "nuxt-content-twoslash": "^0.1.2",
67
- "playwright-core": "^1.51.1",
68
- "sass": "^1.86.3",
69
- "typescript": "5.8.3",
70
- "vitest": "^3.1.1",
71
- "vue-tsc": "^2.2.8"
67
+ "playwright-core": "^1.52.0",
68
+ "sass": "^1.87.0",
69
+ "typescript": "^5.8.3",
70
+ "vitest": "^3.1.2",
71
+ "vue-tsc": "^2.2.10"
72
72
  },
73
73
  "scripts": {
74
74
  "lint": "eslint . --fix",