nuxt-seo-utils 7.0.1 → 7.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
|
@@ -20,25 +20,23 @@ function titleCase(s) {
|
|
|
20
20
|
const BreadcrumbCtx = Symbol("BreadcrumbCtx");
|
|
21
21
|
export function useBreadcrumbItems(_options = {}) {
|
|
22
22
|
const vm = getCurrentInstance();
|
|
23
|
+
const id = _options.id || "breadcrumb";
|
|
23
24
|
let stateRef = null;
|
|
24
|
-
let isCreatingState = false;
|
|
25
25
|
if (vm) {
|
|
26
26
|
stateRef = inject(BreadcrumbCtx, null);
|
|
27
27
|
if (!stateRef) {
|
|
28
28
|
stateRef = ref({});
|
|
29
29
|
provide(BreadcrumbCtx, stateRef);
|
|
30
|
-
isCreatingState = false;
|
|
31
30
|
}
|
|
32
|
-
const id2 = "breadcrumb";
|
|
33
31
|
const state = stateRef.value;
|
|
34
|
-
if (!state[
|
|
35
|
-
state[
|
|
32
|
+
if (!state[id]) {
|
|
33
|
+
state[id] = [];
|
|
36
34
|
}
|
|
37
|
-
const idx = state[
|
|
35
|
+
const idx = state[id].push(_options) - 1;
|
|
38
36
|
stateRef.value = state;
|
|
39
37
|
onUnmounted(() => {
|
|
40
38
|
stateRef.value = Object.fromEntries(Object.entries(stateRef.value).map(([k, v]) => {
|
|
41
|
-
if (k ===
|
|
39
|
+
if (k === id) {
|
|
42
40
|
return v.filter((_, i) => i !== idx);
|
|
43
41
|
}
|
|
44
42
|
return v;
|
|
@@ -129,10 +127,10 @@ export function useBreadcrumbItems(_options = {}) {
|
|
|
129
127
|
}).filter(Boolean);
|
|
130
128
|
});
|
|
131
129
|
const schemaOrgEnabled = typeof _options.schemaOrg === "undefined" ? true : _options.schemaOrg;
|
|
132
|
-
if (
|
|
130
|
+
if ((import.meta.dev || import.meta.server || import.meta.env?.NODE_ENV === "test") && schemaOrgEnabled) {
|
|
133
131
|
useSchemaOrg([
|
|
134
132
|
defineBreadcrumb({
|
|
135
|
-
id: `#${
|
|
133
|
+
id: `#${id}`,
|
|
136
134
|
itemListElement: computed(() => items.value.map((item) => ({
|
|
137
135
|
name: item.label || item.ariaLabel,
|
|
138
136
|
item: item.to ? siteResolver(item.to) : void 0
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-seo-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.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",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"case-police": "^1.0.0",
|
|
64
64
|
"cheerio": "1.0.0",
|
|
65
65
|
"eslint": "^9.22.0",
|
|
66
|
-
"happy-dom": "^17.4.
|
|
66
|
+
"happy-dom": "^17.4.3",
|
|
67
67
|
"markdownlint-cli": "^0.44.0",
|
|
68
68
|
"nuxt": "^3.16.0",
|
|
69
69
|
"nuxt-content-twoslash": "^0.1.2",
|