@nuxtjs/sitemap 7.4.9 → 7.4.10
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/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/{SKYDSeR3.js → CjT5ejtq.js} +1 -1
- package/dist/client/_nuxt/{QpeyiL4d.js → DBmpb9dG.js} +1 -1
- package/dist/client/_nuxt/{Cu_iTDKX.js → FE81ed4p.js} +14 -16
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/698c1660-7b4c-4db3-a9a5-6c0e6240b3a7.json +1 -0
- package/dist/client/_nuxt/error-404.DC9fsYfS.css +1 -0
- package/dist/client/_nuxt/error-500.DPVweS-0.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/client/sitemap.xml +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +25 -19
- package/dist/runtime/server/plugins/nuxt-content-v2.js +6 -7
- package/dist/runtime/server/routes/__sitemap__/debug.js +3 -2
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v2.d.ts +1 -1
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.d.ts +3 -1
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +7 -6
- package/dist/runtime/server/routes/sitemap/[sitemap].xml.js +1 -1
- package/dist/runtime/server/sitemap/builder/sitemap.js +63 -73
- package/dist/runtime/server/sitemap/builder/xml.js +81 -169
- package/dist/runtime/server/sitemap/nitro.js +4 -3
- package/dist/runtime/server/sitemap/urlset/normalise.js +29 -26
- package/dist/runtime/types.d.ts +7 -1
- package/dist/runtime/utils-pure.js +1 -1
- package/dist/utils.mjs +1 -2
- package/package.json +14 -14
- package/dist/client/_nuxt/builds/meta/bafd23ec-aaa0-4756-a4c4-11462568906c.json +0 -1
- package/dist/client/_nuxt/error-404.CqOOUcXJ.css +0 -1
- package/dist/client/_nuxt/error-500.jRvomCfk.css +0 -1
|
@@ -5,193 +5,105 @@ export function escapeValueForXml(value) {
|
|
|
5
5
|
return value ? "yes" : "no";
|
|
6
6
|
return xmlEscape(String(value));
|
|
7
7
|
}
|
|
8
|
+
const yesNo = (v) => v === "yes" || v === true ? "yes" : "no";
|
|
8
9
|
const URLSET_OPENING_TAG = '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
|
9
|
-
function buildUrlXml(url) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (url.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (url.lastmod) {
|
|
18
|
-
parts[partIndex++] = ` <lastmod>${url.lastmod}</lastmod>`;
|
|
10
|
+
function buildUrlXml(url, NL, I1, I2, I3, I4) {
|
|
11
|
+
let xml = `${I1}<url>${NL}`;
|
|
12
|
+
if (url.loc) xml += `${I2}<loc>${xmlEscape(url.loc)}</loc>${NL}`;
|
|
13
|
+
if (url.lastmod) xml += `${I2}<lastmod>${url.lastmod}</lastmod>${NL}`;
|
|
14
|
+
if (url.changefreq) xml += `${I2}<changefreq>${url.changefreq}</changefreq>${NL}`;
|
|
15
|
+
if (url.priority !== void 0) {
|
|
16
|
+
const p = typeof url.priority === "number" ? url.priority : Number.parseFloat(url.priority);
|
|
17
|
+
xml += `${I2}<priority>${p % 1 === 0 ? p : p.toFixed(1)}</priority>${NL}`;
|
|
19
18
|
}
|
|
20
|
-
if (url.
|
|
21
|
-
|
|
19
|
+
if (url.alternatives) {
|
|
20
|
+
for (const alt of url.alternatives) {
|
|
21
|
+
let attrs = "";
|
|
22
|
+
for (const [k, v] of Object.entries(alt)) attrs += ` ${k}="${xmlEscape(String(v))}"`;
|
|
23
|
+
xml += `${I2}<xhtml:link rel="alternate"${attrs} />${NL}`;
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
|
-
if (url.
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
if (url.images) {
|
|
27
|
+
for (const img of url.images) {
|
|
28
|
+
xml += `${I2}<image:image>${NL}${I3}<image:loc>${xmlEscape(img.loc)}</image:loc>${NL}`;
|
|
29
|
+
if (img.title) xml += `${I3}<image:title>${xmlEscape(img.title)}</image:title>${NL}`;
|
|
30
|
+
if (img.caption) xml += `${I3}<image:caption>${xmlEscape(img.caption)}</image:caption>${NL}`;
|
|
31
|
+
if (img.geo_location) xml += `${I3}<image:geo_location>${xmlEscape(img.geo_location)}</image:geo_location>${NL}`;
|
|
32
|
+
if (img.license) xml += `${I3}<image:license>${xmlEscape(img.license)}</image:license>${NL}`;
|
|
33
|
+
xml += `${I2}</image:image>${NL}`;
|
|
34
|
+
}
|
|
27
35
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (img.license) parts[partIndex++] = ` <image:license>${escapeValueForXml(img.license)}</image:license>`;
|
|
50
|
-
parts[partIndex++] = " </image:image>";
|
|
51
|
-
}
|
|
36
|
+
if (url.videos) {
|
|
37
|
+
for (const video of url.videos) {
|
|
38
|
+
xml += `${I2}<video:video>${NL}${I3}<video:title>${xmlEscape(video.title)}</video:title>${NL}`;
|
|
39
|
+
if (video.thumbnail_loc) xml += `${I3}<video:thumbnail_loc>${xmlEscape(video.thumbnail_loc)}</video:thumbnail_loc>${NL}`;
|
|
40
|
+
xml += `${I3}<video:description>${xmlEscape(video.description)}</video:description>${NL}`;
|
|
41
|
+
if (video.content_loc) xml += `${I3}<video:content_loc>${xmlEscape(video.content_loc)}</video:content_loc>${NL}`;
|
|
42
|
+
if (video.player_loc) xml += `${I3}<video:player_loc>${xmlEscape(video.player_loc)}</video:player_loc>${NL}`;
|
|
43
|
+
if (video.duration !== void 0) xml += `${I3}<video:duration>${video.duration}</video:duration>${NL}`;
|
|
44
|
+
if (video.expiration_date) xml += `${I3}<video:expiration_date>${video.expiration_date}</video:expiration_date>${NL}`;
|
|
45
|
+
if (video.rating !== void 0) xml += `${I3}<video:rating>${video.rating}</video:rating>${NL}`;
|
|
46
|
+
if (video.view_count !== void 0) xml += `${I3}<video:view_count>${video.view_count}</video:view_count>${NL}`;
|
|
47
|
+
if (video.publication_date) xml += `${I3}<video:publication_date>${video.publication_date}</video:publication_date>${NL}`;
|
|
48
|
+
if (video.family_friendly !== void 0) xml += `${I3}<video:family_friendly>${yesNo(video.family_friendly)}</video:family_friendly>${NL}`;
|
|
49
|
+
if (video.restriction) xml += `${I3}<video:restriction relationship="${video.restriction.relationship || "allow"}">${xmlEscape(video.restriction.restriction)}</video:restriction>${NL}`;
|
|
50
|
+
if (video.platform) xml += `${I3}<video:platform relationship="${video.platform.relationship || "allow"}">${xmlEscape(video.platform.platform)}</video:platform>${NL}`;
|
|
51
|
+
if (video.requires_subscription !== void 0) xml += `${I3}<video:requires_subscription>${yesNo(video.requires_subscription)}</video:requires_subscription>${NL}`;
|
|
52
|
+
if (video.price) {
|
|
53
|
+
for (const price of video.price) {
|
|
54
|
+
const c = price.currency ? ` currency="${price.currency}"` : "";
|
|
55
|
+
const t = price.type ? ` type="${price.type}"` : "";
|
|
56
|
+
xml += `${I3}<video:price${c}${t}>${xmlEscape(String(price.price ?? ""))}</video:price>${NL}`;
|
|
52
57
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (video.player_loc) {
|
|
67
|
-
const attrs = video.player_loc.allow_embed ? ' allow_embed="yes"' : "";
|
|
68
|
-
const autoplay = video.player_loc.autoplay ? ' autoplay="yes"' : "";
|
|
69
|
-
parts[partIndex++] = ` <video:player_loc${attrs}${autoplay}>${escapeValueForXml(video.player_loc)}</video:player_loc>`;
|
|
70
|
-
}
|
|
71
|
-
if (video.duration !== void 0) {
|
|
72
|
-
parts[partIndex++] = ` <video:duration>${video.duration}</video:duration>`;
|
|
73
|
-
}
|
|
74
|
-
if (video.expiration_date) {
|
|
75
|
-
parts[partIndex++] = ` <video:expiration_date>${video.expiration_date}</video:expiration_date>`;
|
|
76
|
-
}
|
|
77
|
-
if (video.rating !== void 0) {
|
|
78
|
-
parts[partIndex++] = ` <video:rating>${video.rating}</video:rating>`;
|
|
79
|
-
}
|
|
80
|
-
if (video.view_count !== void 0) {
|
|
81
|
-
parts[partIndex++] = ` <video:view_count>${video.view_count}</video:view_count>`;
|
|
82
|
-
}
|
|
83
|
-
if (video.publication_date) {
|
|
84
|
-
parts[partIndex++] = ` <video:publication_date>${video.publication_date}</video:publication_date>`;
|
|
85
|
-
}
|
|
86
|
-
if (video.family_friendly !== void 0) {
|
|
87
|
-
parts[partIndex++] = ` <video:family_friendly>${video.family_friendly === "yes" || video.family_friendly === true ? "yes" : "no"}</video:family_friendly>`;
|
|
88
|
-
}
|
|
89
|
-
if (video.restriction) {
|
|
90
|
-
const relationship = video.restriction.relationship || "allow";
|
|
91
|
-
parts[partIndex++] = ` <video:restriction relationship="${relationship}">${escapeValueForXml(video.restriction.restriction)}</video:restriction>`;
|
|
92
|
-
}
|
|
93
|
-
if (video.platform) {
|
|
94
|
-
const relationship = video.platform.relationship || "allow";
|
|
95
|
-
parts[partIndex++] = ` <video:platform relationship="${relationship}">${escapeValueForXml(video.platform.platform)}</video:platform>`;
|
|
96
|
-
}
|
|
97
|
-
if (video.requires_subscription !== void 0) {
|
|
98
|
-
parts[partIndex++] = ` <video:requires_subscription>${video.requires_subscription === "yes" || video.requires_subscription === true ? "yes" : "no"}</video:requires_subscription>`;
|
|
99
|
-
}
|
|
100
|
-
if (video.price) {
|
|
101
|
-
const prices = Array.isArray(video.price) ? video.price : [video.price];
|
|
102
|
-
for (const price of prices) {
|
|
103
|
-
const attrs = [];
|
|
104
|
-
if (price.currency) attrs.push(`currency="${price.currency}"`);
|
|
105
|
-
if (price.type) attrs.push(`type="${price.type}"`);
|
|
106
|
-
const attrsStr = attrs.length > 0 ? " " + attrs.join(" ") : "";
|
|
107
|
-
parts[partIndex++] = ` <video:price${attrsStr}>${escapeValueForXml(price.price)}</video:price>`;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (video.uploader) {
|
|
111
|
-
const info = video.uploader.info ? ` info="${escapeValueForXml(video.uploader.info)}"` : "";
|
|
112
|
-
parts[partIndex++] = ` <video:uploader${info}>${escapeValueForXml(video.uploader.uploader)}</video:uploader>`;
|
|
113
|
-
}
|
|
114
|
-
if (video.live !== void 0) {
|
|
115
|
-
parts[partIndex++] = ` <video:live>${video.live === "yes" || video.live === true ? "yes" : "no"}</video:live>`;
|
|
116
|
-
}
|
|
117
|
-
if (video.tag) {
|
|
118
|
-
const tags = Array.isArray(video.tag) ? video.tag : [video.tag];
|
|
119
|
-
for (const tag of tags) {
|
|
120
|
-
parts[partIndex++] = ` <video:tag>${escapeValueForXml(tag)}</video:tag>`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (video.category) {
|
|
124
|
-
parts[partIndex++] = ` <video:category>${escapeValueForXml(video.category)}</video:category>`;
|
|
125
|
-
}
|
|
126
|
-
if (video.gallery_loc) {
|
|
127
|
-
const title = video.gallery_loc.title ? ` title="${escapeValueForXml(video.gallery_loc.title)}"` : "";
|
|
128
|
-
parts[partIndex++] = ` <video:gallery_loc${title}>${escapeValueForXml(video.gallery_loc)}</video:gallery_loc>`;
|
|
129
|
-
}
|
|
130
|
-
parts[partIndex++] = " </video:video>";
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
break;
|
|
134
|
-
case "news":
|
|
135
|
-
if (value) {
|
|
136
|
-
parts[partIndex++] = " <news:news>";
|
|
137
|
-
parts[partIndex++] = " <news:publication>";
|
|
138
|
-
parts[partIndex++] = ` <news:name>${escapeValueForXml(value.publication.name)}</news:name>`;
|
|
139
|
-
parts[partIndex++] = ` <news:language>${escapeValueForXml(value.publication.language)}</news:language>`;
|
|
140
|
-
parts[partIndex++] = " </news:publication>";
|
|
141
|
-
if (value.title) {
|
|
142
|
-
parts[partIndex++] = ` <news:title>${escapeValueForXml(value.title)}</news:title>`;
|
|
143
|
-
}
|
|
144
|
-
if (value.publication_date) {
|
|
145
|
-
parts[partIndex++] = ` <news:publication_date>${value.publication_date}</news:publication_date>`;
|
|
146
|
-
}
|
|
147
|
-
if (value.access) {
|
|
148
|
-
parts[partIndex++] = ` <news:access>${value.access}</news:access>`;
|
|
149
|
-
}
|
|
150
|
-
if (value.genres) {
|
|
151
|
-
parts[partIndex++] = ` <news:genres>${escapeValueForXml(value.genres)}</news:genres>`;
|
|
152
|
-
}
|
|
153
|
-
if (value.keywords) {
|
|
154
|
-
parts[partIndex++] = ` <news:keywords>${escapeValueForXml(value.keywords)}</news:keywords>`;
|
|
155
|
-
}
|
|
156
|
-
if (value.stock_tickers) {
|
|
157
|
-
parts[partIndex++] = ` <news:stock_tickers>${escapeValueForXml(value.stock_tickers)}</news:stock_tickers>`;
|
|
158
|
-
}
|
|
159
|
-
parts[partIndex++] = " </news:news>";
|
|
160
|
-
}
|
|
161
|
-
break;
|
|
58
|
+
}
|
|
59
|
+
if (video.uploader) {
|
|
60
|
+
const info = video.uploader.info ? ` info="${xmlEscape(video.uploader.info)}"` : "";
|
|
61
|
+
xml += `${I3}<video:uploader${info}>${xmlEscape(video.uploader.uploader)}</video:uploader>${NL}`;
|
|
62
|
+
}
|
|
63
|
+
if (video.live !== void 0) xml += `${I3}<video:live>${yesNo(video.live)}</video:live>${NL}`;
|
|
64
|
+
if (video.tag) {
|
|
65
|
+
const tags = Array.isArray(video.tag) ? video.tag : [video.tag];
|
|
66
|
+
for (const t of tags) xml += `${I3}<video:tag>${xmlEscape(t)}</video:tag>${NL}`;
|
|
67
|
+
}
|
|
68
|
+
if (video.category) xml += `${I3}<video:category>${xmlEscape(video.category)}</video:category>${NL}`;
|
|
69
|
+
if (video.gallery_loc) xml += `${I3}<video:gallery_loc>${xmlEscape(video.gallery_loc)}</video:gallery_loc>${NL}`;
|
|
70
|
+
xml += `${I2}</video:video>${NL}`;
|
|
162
71
|
}
|
|
163
72
|
}
|
|
164
|
-
|
|
165
|
-
|
|
73
|
+
if (url.news) {
|
|
74
|
+
xml += `${I2}<news:news>${NL}${I3}<news:publication>${NL}`;
|
|
75
|
+
xml += `${I4}<news:name>${xmlEscape(url.news.publication.name)}</news:name>${NL}`;
|
|
76
|
+
xml += `${I4}<news:language>${xmlEscape(url.news.publication.language)}</news:language>${NL}`;
|
|
77
|
+
xml += `${I3}</news:publication>${NL}`;
|
|
78
|
+
if (url.news.title) xml += `${I3}<news:title>${xmlEscape(url.news.title)}</news:title>${NL}`;
|
|
79
|
+
if (url.news.publication_date) xml += `${I3}<news:publication_date>${url.news.publication_date}</news:publication_date>${NL}`;
|
|
80
|
+
xml += `${I2}</news:news>${NL}`;
|
|
81
|
+
}
|
|
82
|
+
xml += `${I1}</url>`;
|
|
83
|
+
return xml;
|
|
166
84
|
}
|
|
167
85
|
export function urlsToXml(urls, resolvers, { version, xsl, credits, minify }, errorInfo) {
|
|
168
|
-
const estimatedSize = urls.length + 5;
|
|
169
|
-
const xmlParts = Array.from({ length: estimatedSize });
|
|
170
|
-
let partIndex = 0;
|
|
171
86
|
let xslHref = xsl ? resolvers.relativeBaseUrlResolver(xsl) : false;
|
|
172
|
-
if (xslHref && errorInfo
|
|
87
|
+
if (xslHref && errorInfo?.messages.length) {
|
|
173
88
|
xslHref = withQuery(xslHref, {
|
|
174
89
|
errors: "true",
|
|
175
90
|
error_messages: errorInfo.messages,
|
|
176
91
|
error_urls: errorInfo.urls
|
|
177
92
|
});
|
|
178
93
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
94
|
+
const NL = minify ? "" : "\n";
|
|
95
|
+
const I1 = minify ? "" : " ";
|
|
96
|
+
const I2 = minify ? "" : " ";
|
|
97
|
+
const I3 = minify ? "" : " ";
|
|
98
|
+
const I4 = minify ? "" : " ";
|
|
99
|
+
let xml = xslHref ? `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="${escapeValueForXml(xslHref)}"?>${NL}` : `<?xml version="1.0" encoding="UTF-8"?>${NL}`;
|
|
100
|
+
xml += URLSET_OPENING_TAG + NL;
|
|
185
101
|
for (const url of urls) {
|
|
186
|
-
|
|
102
|
+
xml += buildUrlXml(url, NL, I1, I2, I3, I4) + NL;
|
|
187
103
|
}
|
|
188
|
-
|
|
104
|
+
xml += "</urlset>";
|
|
189
105
|
if (credits) {
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
const xmlContent = xmlParts.slice(0, partIndex);
|
|
193
|
-
if (minify) {
|
|
194
|
-
return xmlContent.join("").replace(/(?<!<[^>]*)\s(?![^<]*>)/g, "");
|
|
106
|
+
xml += `${NL}<!-- XML Sitemap generated by @nuxtjs/sitemap v${version} at ${(/* @__PURE__ */ new Date()).toISOString()} -->`;
|
|
195
107
|
}
|
|
196
|
-
return
|
|
108
|
+
return xml;
|
|
197
109
|
}
|
|
@@ -35,7 +35,7 @@ async function buildSitemapXml(event, definition, resolvers, runtimeConfig) {
|
|
|
35
35
|
nitro._sitemapWarned = true;
|
|
36
36
|
logger.error("Sitemap Site URL missing!");
|
|
37
37
|
logger.info("To fix this please add `{ site: { url: 'site.com' } }` to your Nuxt config or a `NUXT_PUBLIC_SITE_URL=site.com` to your .env. Learn more at https://nuxtseo.com/site-config/getting-started/how-it-works");
|
|
38
|
-
throw
|
|
38
|
+
throw createError({
|
|
39
39
|
statusMessage: "You must provide a site URL to prerender a sitemap.",
|
|
40
40
|
statusCode: 500
|
|
41
41
|
});
|
|
@@ -78,8 +78,9 @@ async function buildSitemapXml(event, definition, resolvers, runtimeConfig) {
|
|
|
78
78
|
resolvedCtx.urls = resolvedCtx.urls.map((e) => preNormalizeEntry(e, resolvers));
|
|
79
79
|
}
|
|
80
80
|
const maybeSort = (urls2) => runtimeConfig.sortEntries ? sortInPlace(urls2) : urls2;
|
|
81
|
-
const
|
|
82
|
-
const
|
|
81
|
+
const defaults = definition.defaults || {};
|
|
82
|
+
const normalizedPreDedupe = resolvedCtx.urls.map((e) => normaliseEntry(e, defaults, resolvers));
|
|
83
|
+
const urls = maybeSort(mergeOnKey(normalizedPreDedupe, "_key").map((e) => normaliseEntry(e, defaults, resolvers)));
|
|
83
84
|
if (definition._isChunking && definition.sitemapName.includes("-")) {
|
|
84
85
|
const parts = definition.sitemapName.split("-");
|
|
85
86
|
const lastPart = parts.pop();
|
|
@@ -11,36 +11,39 @@ import {
|
|
|
11
11
|
import { defu } from "defu";
|
|
12
12
|
import { mergeOnKey } from "../../../utils-pure.js";
|
|
13
13
|
function resolve(s, resolvers) {
|
|
14
|
-
if (typeof s === "undefined"
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
return
|
|
19
|
-
|
|
14
|
+
if (typeof s === "undefined")
|
|
15
|
+
return void 0;
|
|
16
|
+
const str = typeof s === "string" ? s : s.toString();
|
|
17
|
+
if (!resolvers)
|
|
18
|
+
return str;
|
|
19
|
+
if (hasProtocol(str, { acceptRelative: true, strict: false }))
|
|
20
|
+
return resolvers.fixSlashes(str);
|
|
21
|
+
return resolvers.canonicalUrlResolver(str);
|
|
20
22
|
}
|
|
21
23
|
function removeTrailingSlash(s) {
|
|
22
24
|
return s.replace(/\/(\?|#|$)/, "$1");
|
|
23
25
|
}
|
|
24
26
|
export function preNormalizeEntry(_e, resolvers) {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
delete e.url;
|
|
27
|
+
const input = typeof _e === "string" ? { loc: _e } : { ..._e };
|
|
28
|
+
if (input.url && !input.loc) {
|
|
29
|
+
input.loc = input.url;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
delete input.url;
|
|
32
|
+
if (typeof input.loc !== "string") {
|
|
33
|
+
input.loc = "";
|
|
32
34
|
}
|
|
35
|
+
const e = input;
|
|
33
36
|
e.loc = removeTrailingSlash(e.loc);
|
|
34
37
|
e._abs = hasProtocol(e.loc, { acceptRelative: false, strict: false });
|
|
35
38
|
try {
|
|
36
39
|
e._path = e._abs ? parseURL(e.loc) : parsePath(e.loc);
|
|
37
|
-
} catch
|
|
38
|
-
|
|
40
|
+
} catch {
|
|
41
|
+
e._path = null;
|
|
39
42
|
}
|
|
40
43
|
if (e._path) {
|
|
41
|
-
const
|
|
42
|
-
const qs = stringifyQuery(
|
|
43
|
-
e._relativeLoc = `${encodePath(e._path
|
|
44
|
+
const search = e._path.search;
|
|
45
|
+
const qs = search && search.length > 1 ? stringifyQuery(parseQuery(search)) : "";
|
|
46
|
+
e._relativeLoc = `${encodePath(e._path.pathname)}${qs.length ? `?${qs}` : ""}`;
|
|
44
47
|
if (e._path.host) {
|
|
45
48
|
e.loc = stringifyParsedURL(e._path);
|
|
46
49
|
} else {
|
|
@@ -76,8 +79,7 @@ export function normaliseEntry(_e, defaults, resolvers) {
|
|
|
76
79
|
e.loc = resolve(e.loc, resolvers);
|
|
77
80
|
if (e.alternatives) {
|
|
78
81
|
const alternatives = e.alternatives.map((a) => ({ ...a }));
|
|
79
|
-
for (
|
|
80
|
-
const alt = alternatives[i];
|
|
82
|
+
for (const alt of alternatives) {
|
|
81
83
|
if (typeof alt.href === "string") {
|
|
82
84
|
alt.href = resolve(alt.href, resolvers);
|
|
83
85
|
} else if (typeof alt.href === "object" && alt.href) {
|
|
@@ -88,16 +90,16 @@ export function normaliseEntry(_e, defaults, resolvers) {
|
|
|
88
90
|
}
|
|
89
91
|
if (e.images) {
|
|
90
92
|
const images = e.images.map((i) => ({ ...i }));
|
|
91
|
-
for (
|
|
92
|
-
|
|
93
|
+
for (const img of images) {
|
|
94
|
+
img.loc = resolve(img.loc, resolvers);
|
|
93
95
|
}
|
|
94
96
|
e.images = mergeOnKey(images, "loc");
|
|
95
97
|
}
|
|
96
98
|
if (e.videos) {
|
|
97
99
|
const videos = e.videos.map((v) => ({ ...v }));
|
|
98
|
-
for (
|
|
99
|
-
if (
|
|
100
|
-
|
|
100
|
+
for (const video of videos) {
|
|
101
|
+
if (video.content_loc) {
|
|
102
|
+
video.content_loc = resolve(video.content_loc, resolvers);
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
e.videos = mergeOnKey(videos, "content_loc");
|
|
@@ -115,8 +117,9 @@ export function isValidW3CDate(d) {
|
|
|
115
117
|
}
|
|
116
118
|
export function normaliseDate(d) {
|
|
117
119
|
if (typeof d === "string") {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
const tIdx = d.indexOf("T");
|
|
121
|
+
if (tIdx !== -1) {
|
|
122
|
+
const t = d.slice(tIdx + 1);
|
|
120
123
|
if (!t.includes("+") && !t.includes("-") && !t.includes("Z")) {
|
|
121
124
|
d += "Z";
|
|
122
125
|
}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -247,7 +247,7 @@ export type ResolvedSitemapUrl = Omit<SitemapUrl, 'url'> & Required<Pick<Sitemap
|
|
|
247
247
|
/**
|
|
248
248
|
* @internal
|
|
249
249
|
*/
|
|
250
|
-
_path: ParsedURL;
|
|
250
|
+
_path: ParsedURL | null;
|
|
251
251
|
/**
|
|
252
252
|
* @internal
|
|
253
253
|
*/
|
|
@@ -362,6 +362,10 @@ export interface SitemapSourcesHookCtx extends NitroBaseHook {
|
|
|
362
362
|
export type Changefreq = 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
|
|
363
363
|
export interface SitemapUrl {
|
|
364
364
|
loc: string;
|
|
365
|
+
/**
|
|
366
|
+
* Alias for `loc`. Will be normalized to `loc`.
|
|
367
|
+
*/
|
|
368
|
+
url?: string;
|
|
365
369
|
lastmod?: string | Date;
|
|
366
370
|
changefreq?: Changefreq;
|
|
367
371
|
priority?: 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1;
|
|
@@ -436,6 +440,8 @@ export interface VideoEntry {
|
|
|
436
440
|
};
|
|
437
441
|
live?: 'yes' | 'no' | boolean;
|
|
438
442
|
tag?: string | string[];
|
|
443
|
+
category?: string;
|
|
444
|
+
gallery_loc?: string | URL;
|
|
439
445
|
}
|
|
440
446
|
export interface Restriction {
|
|
441
447
|
relationship: 'allow' | 'deny';
|
|
@@ -30,7 +30,7 @@ export function mergeOnKey(arr, key) {
|
|
|
30
30
|
}
|
|
31
31
|
export function splitForLocales(path, locales) {
|
|
32
32
|
const prefix = withLeadingSlash(path).split("/")[1];
|
|
33
|
-
if (locales.includes(prefix))
|
|
33
|
+
if (prefix && locales.includes(prefix))
|
|
34
34
|
return [prefix, path.replace(`/${prefix}`, "")];
|
|
35
35
|
return [null, path];
|
|
36
36
|
}
|
package/dist/utils.mjs
CHANGED
|
@@ -319,12 +319,11 @@ function extractUrlFromParsedElement(urlElement, warnings) {
|
|
|
319
319
|
});
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
|
|
322
|
+
return Object.fromEntries(
|
|
323
323
|
Object.entries(urlObj).filter(
|
|
324
324
|
([_, value]) => value != null && (!Array.isArray(value) || value.length > 0)
|
|
325
325
|
)
|
|
326
326
|
);
|
|
327
|
-
return filteredUrlObj;
|
|
328
327
|
}
|
|
329
328
|
async function parseSitemapXml(xml) {
|
|
330
329
|
const warnings = [];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/sitemap",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.4.
|
|
4
|
+
"version": "7.4.10",
|
|
5
5
|
"description": "Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@nuxt/devtools-kit": "^3.1.1",
|
|
52
|
-
"@nuxt/kit": "^4.2.
|
|
52
|
+
"@nuxt/kit": "^4.2.2",
|
|
53
53
|
"chalk": "^5.6.2",
|
|
54
54
|
"defu": "^6.1.4",
|
|
55
|
-
"fast-xml-parser": "^5.3.
|
|
55
|
+
"fast-xml-parser": "^5.3.3",
|
|
56
56
|
"h3-compression": "^0.3.2",
|
|
57
|
-
"nuxt-site-config": "^3.2.
|
|
57
|
+
"nuxt-site-config": "^3.2.14",
|
|
58
58
|
"ofetch": "^1.5.1",
|
|
59
59
|
"pathe": "^2.0.3",
|
|
60
60
|
"pkg-types": "^2.3.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"ultrahtml": "^1.6.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"zod": "
|
|
69
|
+
"zod": ">=3"
|
|
70
70
|
},
|
|
71
71
|
"peerDependenciesMeta": {
|
|
72
72
|
"zod": {
|
|
@@ -76,24 +76,24 @@
|
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
78
78
|
"@nuxt/content": "^3.9.0",
|
|
79
|
-
"@nuxt/eslint-config": "^1.
|
|
79
|
+
"@nuxt/eslint-config": "^1.12.1",
|
|
80
80
|
"@nuxt/module-builder": "^1.0.2",
|
|
81
81
|
"@nuxt/test-utils": "^3.21.0",
|
|
82
82
|
"@nuxt/ui": "^4.2.1",
|
|
83
83
|
"@nuxtjs/i18n": "^10.2.1",
|
|
84
|
-
"@nuxtjs/robots": "^5.6.
|
|
84
|
+
"@nuxtjs/robots": "^5.6.7",
|
|
85
85
|
"better-sqlite3": "^12.5.0",
|
|
86
86
|
"bumpp": "^10.3.2",
|
|
87
|
-
"eslint": "^9.39.
|
|
87
|
+
"eslint": "^9.39.2",
|
|
88
88
|
"eslint-plugin-n": "^17.23.1",
|
|
89
89
|
"execa": "^9.6.1",
|
|
90
90
|
"happy-dom": "^20.0.11",
|
|
91
|
-
"nuxt": "^4.2.
|
|
92
|
-
"nuxt-i18n-micro": "^2.
|
|
91
|
+
"nuxt": "^4.2.2",
|
|
92
|
+
"nuxt-i18n-micro": "^2.15.2",
|
|
93
93
|
"typescript": "^5.9.3",
|
|
94
|
-
"vitest": "
|
|
95
|
-
"vue-tsc": "^3.1.
|
|
96
|
-
"@nuxtjs/sitemap": "7.4.
|
|
94
|
+
"vitest": "3.2.4",
|
|
95
|
+
"vue-tsc": "^3.1.8",
|
|
96
|
+
"@nuxtjs/sitemap": "7.4.10"
|
|
97
97
|
},
|
|
98
98
|
"scripts": {
|
|
99
99
|
"lint": "eslint .",
|
|
@@ -110,6 +110,6 @@
|
|
|
110
110
|
"test": "vitest run && pnpm run test:attw",
|
|
111
111
|
"test:unit": "vitest --project=unit",
|
|
112
112
|
"test:attw": "attw --pack",
|
|
113
|
-
"typecheck": "
|
|
113
|
+
"typecheck": "nuxt typecheck"
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"bafd23ec-aaa0-4756-a4c4-11462568906c","timestamp":1765075641425,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.grid[data-v-b7aeb0af]{display:grid}.mb-2[data-v-b7aeb0af]{margin-bottom:.5rem}.mb-4[data-v-b7aeb0af]{margin-bottom:1rem}.max-w-520px[data-v-b7aeb0af]{max-width:520px}.min-h-screen[data-v-b7aeb0af]{min-height:100vh}.w-full[data-v-b7aeb0af]{width:100%}.flex[data-v-b7aeb0af]{display:flex}.place-content-center[data-v-b7aeb0af]{place-content:center}.items-center[data-v-b7aeb0af]{align-items:center}.justify-center[data-v-b7aeb0af]{justify-content:center}.overflow-hidden[data-v-b7aeb0af]{overflow:hidden}.bg-white[data-v-b7aeb0af]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-b7aeb0af]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-b7aeb0af]{text-align:center}.text-\[80px\][data-v-b7aeb0af]{font-size:80px}.text-2xl[data-v-b7aeb0af]{font-size:1.5rem;line-height:2rem}.text-sm[data-v-b7aeb0af]{font-size:.875rem;line-height:1.25rem}.text-\[\#020420\][data-v-b7aeb0af]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\[\#64748B\][data-v-b7aeb0af]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.hover\:text-\[\#00DC82\][data-v-b7aeb0af]:hover{--un-text-opacity:1;color:rgb(0 220 130/var(--un-text-opacity))}.font-medium[data-v-b7aeb0af]{font-weight:500}.font-semibold[data-v-b7aeb0af]{font-weight:600}.leading-none[data-v-b7aeb0af]{line-height:1}.tracking-wide[data-v-b7aeb0af]{letter-spacing:.025em}.font-sans[data-v-b7aeb0af]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-b7aeb0af]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.underline[data-v-b7aeb0af]{text-decoration-line:underline}.underline-offset-3[data-v-b7aeb0af]{text-underline-offset:3px}.antialiased[data-v-b7aeb0af]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-\[\#020420\][data-v-b7aeb0af]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\:text-white[data-v-b7aeb0af]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:text-\[110px\][data-v-b7aeb0af]{font-size:110px}.sm\:text-3xl[data-v-b7aeb0af]{font-size:1.875rem;line-height:2.25rem}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.grid[data-v-685af77a]{display:grid}.mb-2[data-v-685af77a]{margin-bottom:.5rem}.mb-4[data-v-685af77a]{margin-bottom:1rem}.max-w-520px[data-v-685af77a]{max-width:520px}.min-h-screen[data-v-685af77a]{min-height:100vh}.place-content-center[data-v-685af77a]{place-content:center}.overflow-hidden[data-v-685af77a]{overflow:hidden}.bg-white[data-v-685af77a]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-685af77a]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-685af77a]{text-align:center}.text-\[80px\][data-v-685af77a]{font-size:80px}.text-2xl[data-v-685af77a]{font-size:1.5rem;line-height:2rem}.text-\[\#020420\][data-v-685af77a]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\[\#64748B\][data-v-685af77a]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.font-semibold[data-v-685af77a]{font-weight:600}.leading-none[data-v-685af77a]{line-height:1}.tracking-wide[data-v-685af77a]{letter-spacing:.025em}.font-sans[data-v-685af77a]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-685af77a]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.antialiased[data-v-685af77a]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-\[\#020420\][data-v-685af77a]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\:text-white[data-v-685af77a]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:text-\[110px\][data-v-685af77a]{font-size:110px}.sm\:text-3xl[data-v-685af77a]{font-size:1.875rem;line-height:2.25rem}}
|