@nuxtjs/sitemap 7.5.2 → 7.6.0
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/_fonts/0xp3SbCWC1OhX7q1-uF6kilMZFm-alJNkUtkLTPCy_A-tN9KwPUWhhXvtqh74sU9FIkI4W6hsbm85r0X24hjOfM.woff2 +0 -0
- package/dist/client/_fonts/1ZTlEDqU4DtwDJiND8f6qaugUpa0RIDvQl-v7iM6l54-995OEiyou9G2dJsMNn9aLuHTFlgwosm_9gD5SQUWR40.woff +0 -0
- package/dist/client/_fonts/1ZTlEDqU4DtwDJiND8f6qaugUpa0RIDvQl-v7iM6l54-D6hedAgqRfOCLZzaShnyeAvlEnMzk4Wm7g9WDKWFHIc.woff +0 -0
- package/dist/client/_fonts/1ZTlEDqU4DtwDJiND8f6qaugUpa0RIDvQl-v7iM6l54-vrK12kZ24WGUghky9YxsOZpLH8Tt4jMU8XIvzgLQ6DU.woff +0 -0
- package/dist/client/_fonts/4HA9tc4y8BVQeLXvLn3JgQqilAj1xrAnUSprQGHIPSw-ZPswEL_UDOYaxTLQDUySPjoOHDxhD83pD19HMfKfK9s.woff2 +0 -0
- package/dist/client/_fonts/Bmul3LaKlc7BUKqJHE_UmEoF40Sg_2ga52yJjwyDcKs-TnYmYl1DNYkiWMu0Vx49DakCPBuiCCj9zoLIuQjUdKY.woff2 +0 -0
- package/dist/client/_fonts/DfgmjWGpWte3Q3a54Nevr_BYmMM5YEJXRI1CdI2VwO0-ox5RadQfCyVTmKl_hubTaIJjtRw9oaQz2GDBeZR6l1M.woff2 +0 -0
- package/dist/client/_fonts/LK8hREFNeTe-EIzvbfgusJBg3CJ7Q7NFgYIiGb2LZ8-qiyWl0ATLJjOsRPZC_7a8mTMFxEMKEv6JTK_kHtMzbM.woff2 +0 -0
- package/dist/client/_fonts/Lc_5lWuBuZcZ166p1-s-mnGkMJwIYJE_QDCkws8iCkI-r45Qbm2hCykrfOZ0kowz__uTTTUOPDN9hz34QcRNTY4.woff2 +0 -0
- package/dist/client/_fonts/UBlOS9e0BmJuiF5yVs0YcJrFWaa-iN8zx9TP_lmKs8c-iH3Naewt5UjJ0AQ38QZs4lkEo4zdjMIVkLs4y7EiwIE.woff2 +0 -0
- package/dist/client/_fonts/gRxGIWazSFZVyzU0s62U9IArK3RJLkOoUmXx0C8Npsw-kMFNQG6iwjw2nvqS3ut9jMSVn__HlJ28slvxjE4hYfc.woff2 +0 -0
- package/dist/client/_fonts/hIKtJJBMNYGPUppSYZpyuF6c24cKhBkhsgaCTgzYgqw-jRJyBPlfGDXClyrgfO6GK_Pfs1RmTsB-wWX6MOgpsRA.woff2 +0 -0
- package/dist/client/_fonts/iEvApgDRmzKzNqOYocBTrmcHZmuGAJloawKDP1S0nyE-T3oc_9We24QGwfw5naik4cM0g7VxylWVaQwKm4dy3cw.woff2 +0 -0
- package/dist/client/_fonts/kokcBTWRechd97ZdVUpUxrOFbsRt8whO21yA1vQ6iJ8-O7CCbVvFgg_MFLTdyFF9FMeMvIoEmxJLubqVDYTUoWY.woff2 +0 -0
- package/dist/client/_fonts/oFzdhjQtZFydTZ757bmiVFXgReR2bBSYm_CjQ7B1Jjs-F6oFbDhOWKYJbgrlC93wkLkPlIV7mzgvqwqEDxQMeHA.woff2 +0 -0
- package/dist/client/_nuxt/5ZF0DUKe.js +1 -0
- package/dist/client/_nuxt/8XcEHgiq.js +1 -0
- package/dist/client/_nuxt/B2G1Husz.js +1 -0
- package/dist/client/_nuxt/B6Rjxwce.js +1 -0
- package/dist/client/_nuxt/BTnenz-7.js +1 -0
- package/dist/client/_nuxt/BaarzCY9.js +181 -0
- package/dist/client/_nuxt/BeMtTGFX.js +1 -0
- package/dist/client/_nuxt/BgRd_GNf.js +1 -0
- package/dist/client/_nuxt/Bj_3pTUi.js +1 -0
- package/dist/client/_nuxt/BqgETAYZ.js +1 -0
- package/dist/client/_nuxt/C1-eNu7x.js +1 -0
- package/dist/client/_nuxt/C6MORWr4.js +1 -0
- package/dist/client/_nuxt/CIJ7g9su.js +1 -0
- package/dist/client/_nuxt/CINkxRg5.js +1 -0
- package/dist/client/_nuxt/COIEcBZR.js +1 -0
- package/dist/client/_nuxt/CZ3hLIr1.js +1 -0
- package/dist/client/_nuxt/Caedg1qp.js +1 -0
- package/dist/client/_nuxt/Cmw_hYOm.js +1 -0
- package/dist/client/_nuxt/CxFX6b0M.js +1 -0
- package/dist/client/_nuxt/D4YjxrHq.js +1 -0
- package/dist/client/_nuxt/DHOdika3.js +1 -0
- package/dist/client/_nuxt/DSdw0YSI.js +1 -0
- package/dist/client/_nuxt/DSxZHkX-.js +1 -0
- package/dist/client/_nuxt/Dn8lRF86.js +1 -0
- package/dist/client/_nuxt/DwNiGCgn.js +1 -0
- package/dist/client/_nuxt/O3qB0pnO.js +1 -0
- package/dist/client/_nuxt/ProsePre.D5orA6B_.css +1 -0
- package/dist/client/_nuxt/ZdghZ1ke.js +1 -0
- package/dist/client/_nuxt/aUtIlT-b.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/6319eec7-8aee-40f4-abcf-31c51d4b20a5.json +1 -0
- package/dist/client/_nuxt/entry.D1qdnVLM.css +1 -0
- package/dist/client/_nuxt/error-404.BBebgf1Y.css +1 -0
- package/dist/client/_nuxt/error-500.C4WF4yER.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/content.d.mts +53 -3
- package/dist/content.d.ts +53 -3
- package/dist/content.mjs +15 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +134 -59
- package/dist/runtime/server/routes/__sitemap__/debug.d.ts +2 -2
- package/dist/runtime/server/routes/__sitemap__/debug.js +21 -2
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.d.ts +1 -3
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +22 -10
- package/dist/runtime/server/routes/sitemap.xsl.js +345 -149
- package/dist/runtime/server/sitemap/builder/sitemap.js +16 -1
- package/dist/runtime/server/sitemap/builder/xml.js +4 -0
- package/dist/runtime/server/sitemap/event-handlers.js +12 -3
- package/dist/runtime/server/sitemap/nitro.js +12 -3
- package/dist/runtime/server/sitemap/urlset/normalise.d.ts +2 -1
- package/dist/runtime/server/sitemap/urlset/normalise.js +24 -0
- package/dist/runtime/server/sitemap/urlset/sources.js +1 -1
- package/dist/runtime/types.d.ts +9 -0
- package/dist/utils.d.mts +13 -2
- package/dist/utils.d.ts +13 -2
- package/dist/utils.mjs +54 -1
- package/package.json +17 -18
- package/dist/client/__sitemap__/style.xsl +0 -190
- package/dist/client/_nuxt/CVDC-Ayb.js +0 -155
- package/dist/client/_nuxt/builds/meta/1e2c692d-9f57-4b49-a518-f0dad9ea1e8b.json +0 -1
- package/dist/client/_nuxt/byQmnvHb.js +0 -1
- package/dist/client/_nuxt/cP7UVfHI.js +0 -1
- package/dist/client/_nuxt/entry.Ci1pP-eR.css +0 -1
- package/dist/client/_nuxt/error-404.DHoMe5Vi.css +0 -1
- package/dist/client/_nuxt/error-500.Da7n0rc6.css +0 -1
- package/dist/client/sitemap.xml +0 -7
- package/virtual.d.ts +0 -15
|
@@ -11,20 +11,18 @@ export default defineEventHandler(async (e) => {
|
|
|
11
11
|
setHeader(e, "Cache-Control", `public, max-age=${cacheMaxAgeSeconds}, must-revalidate`);
|
|
12
12
|
else
|
|
13
13
|
setHeader(e, "Cache-Control", `no-cache, no-store`);
|
|
14
|
-
const svgIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="icon" style="margin-right: 4px; font-size: 25px;" width="1em" height="1em" viewBox="0 0 32 32"><path fill="#93c5fd" d="M4 26h4v4H4zm10 0h4v4h-4zm10 0h4v4h-4zm1-10h-8v-2h-2v2H7a2.002 2.002 0 0 0-2 2v6h2v-6h8v6h2v-6h8v6h2v-6a2.002 2.002 0 0 0-2-2zM9 2v10h14V2zm2 2h2v6h-2zm10 6h-6V4h6z"></path></svg>`;
|
|
15
|
-
const creditName = `<a href="https://github.com/nuxt-modules/sitemap" style="color: black; display: flex; align-items: center; font-weight: 500;" target="_blank" rel="noopener">${svgIcon} Nuxt Sitemap v${version}</a>`;
|
|
16
14
|
const { name: siteName, url: siteUrl } = useSiteConfig(e);
|
|
17
15
|
const referrer = getHeader(e, "Referer") || "/";
|
|
18
16
|
const referrerPath = parseURL(referrer).pathname;
|
|
19
17
|
const isNotIndexButHasIndex = referrerPath !== "/sitemap.xml" && referrerPath !== "/sitemap_index.xml" && referrerPath.endsWith(".xml");
|
|
20
18
|
const sitemapName = parseURL(referrer).pathname.split("/").pop()?.split("-sitemap")[0] || fallbackSitemapName;
|
|
21
19
|
const title = `${siteName}${sitemapName !== "sitemap.xml" ? ` - ${sitemapName === "sitemap_index.xml" ? "index" : sitemapName}` : ""}`.replace(/&/g, "&");
|
|
20
|
+
const isIndexPage = referrerPath === "/sitemap.xml" || referrerPath === "/sitemap_index.xml";
|
|
22
21
|
const canonicalQuery = getQuery(referrer).canonical;
|
|
23
22
|
const isShowingCanonical = typeof canonicalQuery !== "undefined" && canonicalQuery !== "false";
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
];
|
|
23
|
+
const debugUrl = xmlEscape(withQuery("/__sitemap__/debug.json", { sitemap: sitemapName }));
|
|
24
|
+
const devUrl = xmlEscape(referrerPath);
|
|
25
|
+
const prodUrl = xmlEscape(withQuery(referrerPath, { canonical: "" }));
|
|
28
26
|
const fetchErrors = [];
|
|
29
27
|
const xslQuery = h3GetQuery(e);
|
|
30
28
|
if (xslQuery.error_messages) {
|
|
@@ -35,25 +33,20 @@ export default defineEventHandler(async (e) => {
|
|
|
35
33
|
const urls = Array.isArray(errorUrls) ? errorUrls : errorUrls ? [errorUrls] : [];
|
|
36
34
|
messages.forEach((msg, i) => {
|
|
37
35
|
const errorParts = [xmlEscape(msg)];
|
|
38
|
-
if (urls[i])
|
|
36
|
+
if (urls[i])
|
|
39
37
|
errorParts.push(xmlEscape(urls[i]));
|
|
40
|
-
}
|
|
41
|
-
fetchErrors.push(`<strong style="color: #dc2626;">Error ${i + 1}:</strong> ${errorParts.join(" - ")}`);
|
|
38
|
+
fetchErrors.push(`<span class="error-item">${errorParts.join(" \u2014 ")}</span>`);
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
if (!isShowingCanonical) {
|
|
46
|
-
const canonicalPreviewUrl = withQuery(referrer, { canonical: "" });
|
|
47
|
-
conditionalTips.push(`Your canonical site URL is <strong>${xmlEscape(siteUrl)}</strong>.`);
|
|
48
|
-
conditionalTips.push(`You can preview your canonical sitemap by visiting <a href="${xmlEscape(canonicalPreviewUrl)}" style="color: #398465; white-space: nowrap;">${xmlEscape(fixPath(canonicalPreviewUrl))}?canonical</a>`);
|
|
49
|
-
} else {
|
|
50
|
-
conditionalTips.push(`You are viewing the canonical sitemap. You can switch to using the request origin: <a href="${xmlEscape(fixPath(referrer))}" style="color: #398465; white-space: nowrap ">${xmlEscape(fixPath(referrer))}</a>`);
|
|
51
|
-
}
|
|
52
42
|
const hasRuntimeErrors = fetchErrors.length > 0;
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
const showDevTools = import.meta.dev && xslTips !== false;
|
|
44
|
+
const hints = [
|
|
45
|
+
`This is an XSL sitemap (CSS for XML). Disable with <code>xsl: false</code>`,
|
|
46
|
+
`View the raw XML by adding <code>?canonical</code> to the URL`,
|
|
47
|
+
`Check <code>/__sitemap__/debug.json</code> for full sitemap diagnostics`
|
|
48
|
+
];
|
|
49
|
+
const hint = hints[Math.floor(Math.random() * hints.length)];
|
|
57
50
|
let columns = [...xslColumns];
|
|
58
51
|
if (!columns.length) {
|
|
59
52
|
columns = [
|
|
@@ -77,176 +70,379 @@ export default defineEventHandler(async (e) => {
|
|
|
77
70
|
<title>XML Sitemap</title>
|
|
78
71
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
79
72
|
<style type="text/css">
|
|
73
|
+
:root {
|
|
74
|
+
--accent: #00dc82;
|
|
75
|
+
--accent-hover: #00b86b;
|
|
76
|
+
--bg: #0a0a0a;
|
|
77
|
+
--bg-elevated: #141414;
|
|
78
|
+
--bg-subtle: #1a1a1a;
|
|
79
|
+
--border: #262626;
|
|
80
|
+
--border-subtle: #1f1f1f;
|
|
81
|
+
--text: #e5e5e5;
|
|
82
|
+
--text-muted: #737373;
|
|
83
|
+
--text-faint: #525252;
|
|
84
|
+
--error: #ef4444;
|
|
85
|
+
--error-bg: rgba(239,68,68,0.1);
|
|
86
|
+
--warning: #f59e0b;
|
|
87
|
+
}
|
|
88
|
+
* { box-sizing: border-box; }
|
|
80
89
|
body {
|
|
81
|
-
font-family:
|
|
82
|
-
font-size:
|
|
83
|
-
color:
|
|
90
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
91
|
+
font-size: 13px;
|
|
92
|
+
color: var(--text);
|
|
93
|
+
background: var(--bg);
|
|
94
|
+
margin: 0;
|
|
95
|
+
padding: 0;
|
|
96
|
+
line-height: 1.6;
|
|
97
|
+
-webkit-font-smoothing: antialiased;
|
|
84
98
|
}
|
|
99
|
+
a { color: inherit; transition: color 0.15s; }
|
|
100
|
+
a:hover { color: var(--accent); }
|
|
85
101
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
/* Debug bar (dev only) */
|
|
103
|
+
.debug-bar {
|
|
104
|
+
position: fixed;
|
|
105
|
+
bottom: 0.75rem;
|
|
106
|
+
left: 50%;
|
|
107
|
+
transform: translateX(-50%);
|
|
108
|
+
width: 80%;
|
|
109
|
+
background: var(--bg-elevated);
|
|
110
|
+
border: 1px solid var(--border);
|
|
111
|
+
border-radius: 10px;
|
|
112
|
+
padding: 0 1rem;
|
|
113
|
+
height: 2.5rem;
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: 0.75rem;
|
|
117
|
+
z-index: 100;
|
|
118
|
+
font-size: 11px;
|
|
89
119
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
120
|
+
.debug-bar-brand {
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
gap: 0.5rem;
|
|
124
|
+
color: var(--text-muted);
|
|
125
|
+
text-decoration: none;
|
|
93
126
|
}
|
|
94
|
-
|
|
95
|
-
.
|
|
96
|
-
|
|
127
|
+
.debug-bar-brand:hover { color: var(--text); }
|
|
128
|
+
.debug-bar-brand svg { flex-shrink: 0; }
|
|
129
|
+
.debug-bar-hint {
|
|
130
|
+
color: var(--text-faint);
|
|
131
|
+
margin-right: auto;
|
|
132
|
+
white-space: nowrap;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
text-overflow: ellipsis;
|
|
97
135
|
}
|
|
98
|
-
|
|
99
|
-
|
|
136
|
+
.debug-bar-hint code {
|
|
137
|
+
background: var(--bg-subtle);
|
|
138
|
+
padding: 0.1rem 0.3rem;
|
|
139
|
+
border-radius: 3px;
|
|
140
|
+
font-size: 10px;
|
|
141
|
+
}
|
|
142
|
+
.mode-badge {
|
|
143
|
+
font-size: 9px;
|
|
144
|
+
font-weight: 600;
|
|
145
|
+
text-transform: uppercase;
|
|
146
|
+
letter-spacing: 0.04em;
|
|
147
|
+
padding: 0.2rem 0.4rem;
|
|
148
|
+
border-radius: 3px;
|
|
149
|
+
}
|
|
150
|
+
.mode-dev { background: rgba(245,158,11,0.15); color: var(--warning); }
|
|
151
|
+
.mode-prod { background: rgba(0,220,130,0.12); color: var(--accent); }
|
|
152
|
+
.mode-toggle {
|
|
153
|
+
display: inline-flex;
|
|
100
154
|
border-radius: 4px;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
background: var(--bg-subtle);
|
|
157
|
+
padding: 2px;
|
|
158
|
+
gap: 1px;
|
|
105
159
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
160
|
+
.mode-toggle a {
|
|
161
|
+
padding: 0.2rem 0.4rem;
|
|
162
|
+
font-size: 9px;
|
|
163
|
+
font-weight: 500;
|
|
164
|
+
text-decoration: none;
|
|
165
|
+
color: var(--text-muted);
|
|
166
|
+
border-radius: 2px;
|
|
167
|
+
transition: all 0.15s;
|
|
109
168
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
background
|
|
169
|
+
.mode-toggle a:hover { color: var(--text); }
|
|
170
|
+
.mode-toggle a.active {
|
|
171
|
+
background: var(--accent);
|
|
172
|
+
color: #0a0a0a;
|
|
113
173
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
174
|
+
.btn {
|
|
175
|
+
display: inline-flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
gap: 0.25rem;
|
|
178
|
+
padding: 0.25rem 0.5rem;
|
|
179
|
+
border-radius: 4px;
|
|
180
|
+
text-decoration: none;
|
|
181
|
+
font-size: 10px;
|
|
182
|
+
font-weight: 500;
|
|
183
|
+
transition: all 0.15s;
|
|
117
184
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
color: #
|
|
121
|
-
font-weight: 600;
|
|
185
|
+
.btn-primary {
|
|
186
|
+
background: var(--accent);
|
|
187
|
+
color: #0a0a0a;
|
|
122
188
|
}
|
|
189
|
+
.btn-primary:hover { background: var(--accent-hover); color: #0a0a0a; }
|
|
190
|
+
.btn svg { width: 12px; height: 12px; }
|
|
123
191
|
|
|
124
|
-
|
|
125
|
-
|
|
192
|
+
/* Error banner */
|
|
193
|
+
.error-banner {
|
|
194
|
+
background: var(--error-bg);
|
|
195
|
+
border-bottom: 1px solid rgba(239,68,68,0.2);
|
|
196
|
+
padding: 0.75rem 1.5rem;
|
|
197
|
+
color: #fca5a5;
|
|
198
|
+
font-size: 12px;
|
|
126
199
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
200
|
+
.error-banner strong { color: var(--error); }
|
|
201
|
+
.error-item { display: block; margin-top: 0.375rem; color: #fca5a5; }
|
|
202
|
+
.error-debug-link {
|
|
203
|
+
display: inline-flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
gap: 0.25rem;
|
|
206
|
+
margin-top: 0.625rem;
|
|
207
|
+
padding: 0.25rem 0.5rem;
|
|
208
|
+
background: var(--error);
|
|
209
|
+
color: #fff;
|
|
210
|
+
border-radius: 4px;
|
|
211
|
+
font-size: 11px;
|
|
212
|
+
font-weight: 500;
|
|
130
213
|
text-decoration: none;
|
|
214
|
+
transition: background 0.15s;
|
|
131
215
|
}
|
|
216
|
+
.error-debug-link:hover { background: #dc2626; color: #fff; }
|
|
132
217
|
|
|
133
|
-
|
|
134
|
-
|
|
218
|
+
/* Main content */
|
|
219
|
+
.container {
|
|
220
|
+
max-width: 1200px;
|
|
221
|
+
margin: 0 auto;
|
|
222
|
+
padding: 1.5rem;
|
|
135
223
|
}
|
|
136
|
-
|
|
137
|
-
|
|
224
|
+
.header {
|
|
225
|
+
margin-bottom: 1.25rem;
|
|
226
|
+
}
|
|
227
|
+
.header h1 {
|
|
228
|
+
font-size: 1rem;
|
|
229
|
+
font-weight: 600;
|
|
230
|
+
margin: 0 0 0.25rem 0;
|
|
231
|
+
color: var(--text);
|
|
232
|
+
}
|
|
233
|
+
.header-meta {
|
|
234
|
+
color: var(--text-muted);
|
|
235
|
+
font-size: 12px;
|
|
236
|
+
}
|
|
237
|
+
.header-meta a {
|
|
238
|
+
color: var(--text-muted);
|
|
138
239
|
text-decoration: underline;
|
|
240
|
+
text-decoration-color: var(--border);
|
|
241
|
+
text-underline-offset: 2px;
|
|
139
242
|
}
|
|
243
|
+
.header-meta a:hover { color: var(--accent); text-decoration-color: var(--accent); }
|
|
140
244
|
|
|
245
|
+
/* Table */
|
|
246
|
+
.table-wrap {
|
|
247
|
+
border: 1px solid var(--border);
|
|
248
|
+
border-radius: 8px;
|
|
249
|
+
overflow: hidden;
|
|
250
|
+
background: var(--bg-elevated);
|
|
251
|
+
}
|
|
252
|
+
table {
|
|
253
|
+
width: 100%;
|
|
254
|
+
border-collapse: collapse;
|
|
255
|
+
}
|
|
256
|
+
th {
|
|
257
|
+
text-align: left;
|
|
258
|
+
padding: 0.625rem 1rem;
|
|
259
|
+
font-size: 10px;
|
|
260
|
+
font-weight: 600;
|
|
261
|
+
text-transform: uppercase;
|
|
262
|
+
letter-spacing: 0.05em;
|
|
263
|
+
color: var(--text-muted);
|
|
264
|
+
background: var(--bg-subtle);
|
|
265
|
+
border-bottom: 1px solid var(--border);
|
|
266
|
+
}
|
|
141
267
|
td {
|
|
268
|
+
padding: 0.5rem 1rem;
|
|
269
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
142
270
|
font-size: 12px;
|
|
271
|
+
color: var(--text);
|
|
143
272
|
}
|
|
273
|
+
tr:last-child td { border-bottom: none; }
|
|
274
|
+
tr:hover td { background: rgba(255,255,255,0.02); }
|
|
275
|
+
td a {
|
|
276
|
+
text-decoration: none;
|
|
277
|
+
word-break: break-all;
|
|
278
|
+
color: var(--text);
|
|
279
|
+
}
|
|
280
|
+
td a:hover { color: var(--accent); }
|
|
281
|
+
.inline-warning {
|
|
282
|
+
font-size: 11px;
|
|
283
|
+
color: var(--warning);
|
|
284
|
+
margin-top: 0.25rem;
|
|
285
|
+
line-height: 1.4;
|
|
286
|
+
}
|
|
287
|
+
.inline-warning::before {
|
|
288
|
+
content: "\u26A0 ";
|
|
289
|
+
}
|
|
290
|
+
.count {
|
|
291
|
+
display: inline-block;
|
|
292
|
+
min-width: 1.25rem;
|
|
293
|
+
padding: 0.125rem 0.375rem;
|
|
294
|
+
background: var(--bg-subtle);
|
|
295
|
+
border-radius: 4px;
|
|
296
|
+
text-align: center;
|
|
297
|
+
font-size: 11px;
|
|
298
|
+
color: var(--text-muted);
|
|
299
|
+
font-variant-numeric: tabular-nums;
|
|
300
|
+
}
|
|
301
|
+
.count:empty::before { content: "0"; }
|
|
144
302
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
303
|
+
/* Light mode */
|
|
304
|
+
@media (prefers-color-scheme: light) {
|
|
305
|
+
:root {
|
|
306
|
+
--accent: #00a963;
|
|
307
|
+
--accent-hover: #008f54;
|
|
308
|
+
--bg: #ffffff;
|
|
309
|
+
--bg-elevated: #f5f5f5;
|
|
310
|
+
--bg-subtle: #ebebeb;
|
|
311
|
+
--border: #d4d4d4;
|
|
312
|
+
--border-subtle: #e5e5e5;
|
|
313
|
+
--text: #171717;
|
|
314
|
+
--text-muted: #525252;
|
|
315
|
+
--text-faint: #737373;
|
|
316
|
+
--error: #dc2626;
|
|
317
|
+
--error-bg: rgba(220,38,38,0.08);
|
|
318
|
+
--warning: #b45309;
|
|
319
|
+
}
|
|
320
|
+
tr:hover td { background: rgba(0,0,0,0.02); }
|
|
321
|
+
.btn-primary { color: #fff; }
|
|
322
|
+
.btn-primary:hover { color: #fff; }
|
|
323
|
+
.mode-toggle a.active { color: #fff; }
|
|
324
|
+
.error-banner { color: #991b1b; }
|
|
325
|
+
.error-item { color: #b91c1c; }
|
|
326
|
+
.error-debug-link { color: #fff; }
|
|
327
|
+
.error-debug-link:hover { color: #fff; }
|
|
149
328
|
}
|
|
150
329
|
|
|
151
|
-
|
|
152
|
-
text-
|
|
153
|
-
|
|
154
|
-
font-size: 12px;
|
|
330
|
+
.debug-bar-version {
|
|
331
|
+
color: var(--text-faint);
|
|
332
|
+
font-size: 10px;
|
|
155
333
|
}
|
|
156
334
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
.mb-3 { margin-bottom: 0.75rem; }
|
|
335
|
+
/* Responsive */
|
|
336
|
+
@media (max-width: 640px) {
|
|
337
|
+
.debug-bar { padding: 0 0.75rem; gap: 0.5rem; width: 95%; }
|
|
338
|
+
.debug-bar-brand span { display: none; }
|
|
339
|
+
.debug-bar-hint { display: none; }
|
|
340
|
+
.debug-bar-version { display: none; }
|
|
341
|
+
.mode-badge { display: none; }
|
|
342
|
+
.container { padding: 1rem; }
|
|
343
|
+
th, td { padding: 0.5rem 0.75rem; }
|
|
344
|
+
}
|
|
345
|
+
${showDevTools ? "body { padding-bottom: 3.5rem; }" : ""}
|
|
169
346
|
</style>
|
|
170
347
|
</head>
|
|
171
348
|
<body>
|
|
172
|
-
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
349
|
+
${hasRuntimeErrors ? `<div class="error-banner">
|
|
350
|
+
<strong>Sitemap Generation Errors</strong>
|
|
351
|
+
${fetchErrors.join("")}
|
|
352
|
+
<a href="${debugUrl}" target="_blank" class="error-debug-link">View Debug Info \u2192</a>
|
|
353
|
+
</div>` : ""}
|
|
354
|
+
<div class="container">
|
|
355
|
+
<div class="header">
|
|
356
|
+
<h1>${xmlEscape(title)}</h1>
|
|
357
|
+
<div class="header-meta">
|
|
358
|
+
${isNotIndexButHasIndex ? `Part of <a href="${xmlEscape(fixPath("/sitemap_index.xml"))}">${xmlEscape(fixPath("/sitemap_index.xml"))}</a> \xB7 ` : ""}
|
|
359
|
+
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) > 0">
|
|
360
|
+
<xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> sitemaps
|
|
361
|
+
</xsl:if>
|
|
362
|
+
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1">
|
|
363
|
+
<xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs
|
|
364
|
+
</xsl:if>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
178
367
|
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) > 0">
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
</p>
|
|
183
|
-
<table id="sitemap" cellpadding="3">
|
|
184
|
-
<thead>
|
|
185
|
-
<tr>
|
|
186
|
-
<th width="75%">Sitemap</th>
|
|
187
|
-
<th width="25%">Last Modified</th>
|
|
188
|
-
</tr>
|
|
189
|
-
</thead>
|
|
190
|
-
<tbody>
|
|
191
|
-
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
|
192
|
-
<xsl:variable name="sitemapURL">
|
|
193
|
-
<xsl:value-of select="sitemap:loc"/>
|
|
194
|
-
</xsl:variable>
|
|
368
|
+
<div class="table-wrap">
|
|
369
|
+
<table>
|
|
370
|
+
<thead>
|
|
195
371
|
<tr>
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
<xsl:value-of select="sitemap:loc"/>
|
|
199
|
-
</a>
|
|
200
|
-
</td>
|
|
201
|
-
<td>
|
|
202
|
-
<xsl:value-of
|
|
203
|
-
select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)),concat(' ', substring(sitemap:lastmod,20,6)))"/>
|
|
204
|
-
</td>
|
|
372
|
+
<th style="width:70%">Sitemap</th>
|
|
373
|
+
<th style="width:30%">Last Modified</th>
|
|
205
374
|
</tr>
|
|
206
|
-
</
|
|
207
|
-
|
|
208
|
-
|
|
375
|
+
</thead>
|
|
376
|
+
<tbody>
|
|
377
|
+
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
|
378
|
+
<xsl:variable name="sitemapURL">
|
|
379
|
+
<xsl:value-of select="sitemap:loc"/>
|
|
380
|
+
</xsl:variable>
|
|
381
|
+
<tr>
|
|
382
|
+
<td>
|
|
383
|
+
<a href="{$sitemapURL}">
|
|
384
|
+
<xsl:value-of select="sitemap:loc"/>
|
|
385
|
+
</a>
|
|
386
|
+
</td>
|
|
387
|
+
<td>
|
|
388
|
+
<xsl:value-of
|
|
389
|
+
select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)),concat(' ', substring(sitemap:lastmod,20,6)))"/>
|
|
390
|
+
</td>
|
|
391
|
+
</tr>
|
|
392
|
+
</xsl:for-each>
|
|
393
|
+
</tbody>
|
|
394
|
+
</table>
|
|
395
|
+
</div>
|
|
209
396
|
</xsl:if>
|
|
210
397
|
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1">
|
|
211
|
-
<
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
</p>
|
|
215
|
-
<table id="sitemap" cellpadding="3">
|
|
216
|
-
<thead>
|
|
217
|
-
<tr>
|
|
218
|
-
${columns.map((c) => `<th width="${c.width}">${c.label}</th>`).join("\n")}
|
|
219
|
-
</tr>
|
|
220
|
-
</thead>
|
|
221
|
-
<tbody>
|
|
222
|
-
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
|
223
|
-
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
|
224
|
-
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
|
398
|
+
<div class="table-wrap">
|
|
399
|
+
<table>
|
|
400
|
+
<thead>
|
|
225
401
|
<tr>
|
|
226
|
-
|
|
227
|
-
<xsl:variable name="itemURL">
|
|
228
|
-
<xsl:value-of select="sitemap:loc"/>
|
|
229
|
-
</xsl:variable>
|
|
230
|
-
<a href="{$itemURL}">
|
|
231
|
-
<xsl:value-of select="sitemap:loc"/>
|
|
232
|
-
</a>
|
|
233
|
-
</td>
|
|
234
|
-
${columns.filter((c) => c.label !== "URL").map((c) => `<td>
|
|
235
|
-
<xsl:value-of select="${c.select}"/>
|
|
236
|
-
</td>`).join("\n")}
|
|
402
|
+
${columns.map((c) => `<th style="width:${c.width}">${c.label}</th>`).join("\n")}
|
|
237
403
|
</tr>
|
|
238
|
-
</
|
|
239
|
-
|
|
240
|
-
|
|
404
|
+
</thead>
|
|
405
|
+
<tbody>
|
|
406
|
+
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
|
407
|
+
<tr>
|
|
408
|
+
<td>
|
|
409
|
+
<xsl:variable name="itemURL">
|
|
410
|
+
<xsl:value-of select="sitemap:loc"/>
|
|
411
|
+
</xsl:variable>
|
|
412
|
+
<a href="{$itemURL}">
|
|
413
|
+
<xsl:value-of select="sitemap:loc"/>
|
|
414
|
+
</a>
|
|
415
|
+
${showDevTools ? `<xsl:for-each select="comment()[starts-with(normalize-space(.), 'WARN:')]">
|
|
416
|
+
<div class="inline-warning">
|
|
417
|
+
<xsl:value-of select="substring-after(normalize-space(.), 'WARN:')"/>
|
|
418
|
+
</div>
|
|
419
|
+
</xsl:for-each>` : ""}
|
|
420
|
+
</td>
|
|
421
|
+
${columns.filter((c) => c.label !== "URL").map((c) => `<td><span class="count"><xsl:value-of select="${c.select}"/></span></td>`).join("\n")}
|
|
422
|
+
</tr>
|
|
423
|
+
</xsl:for-each>
|
|
424
|
+
</tbody>
|
|
425
|
+
</table>
|
|
426
|
+
</div>
|
|
241
427
|
</xsl:if>
|
|
242
428
|
</div>
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
429
|
+
${showDevTools ? `<div class="debug-bar">
|
|
430
|
+
<a href="${xmlEscape(fixPath("/sitemap_index.xml"))}" class="debug-bar-brand">
|
|
431
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 32 32"><path fill="#00dc82" d="M4 26h4v4H4zm10 0h4v4h-4zm10 0h4v4h-4zm1-10h-8v-2h-2v2H7a2 2 0 0 0-2 2v6h2v-6h8v6h2v-6h8v6h2v-6a2 2 0 0 0-2-2zM9 2v10h14V2zm2 2h2v6h-2zm10 6h-6V4h6z"/></svg>
|
|
432
|
+
<span>Sitemap Debug Bar</span>
|
|
433
|
+
</a>
|
|
434
|
+
<span class="debug-bar-version">v${version} \xB7 ${xmlEscape(siteUrl)}</span>
|
|
435
|
+
<span class="debug-bar-hint">Hint: ${hint}</span>
|
|
436
|
+
${isIndexPage ? `<span class="mode-badge ${isShowingCanonical ? "mode-prod" : "mode-dev"}">${isShowingCanonical ? "Prod" : "Dev"}</span>
|
|
437
|
+
<div class="mode-toggle">
|
|
438
|
+
<a href="${isShowingCanonical ? devUrl : "#"}" class="${!isShowingCanonical ? "active" : ""}">Dev</a>
|
|
439
|
+
<a href="${!isShowingCanonical ? prodUrl : "#"}" class="${isShowingCanonical ? "active" : ""}">Prod</a>
|
|
440
|
+
</div>` : ""}
|
|
441
|
+
<a href="${debugUrl}" target="_blank" class="btn btn-primary">
|
|
442
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>
|
|
443
|
+
Debug
|
|
444
|
+
</a>
|
|
445
|
+
</div>` : ""}
|
|
250
446
|
</body>
|
|
251
447
|
</html>
|
|
252
448
|
</xsl:template>
|
|
@@ -3,7 +3,7 @@ import { joinURL, withHttps } from "ufo";
|
|
|
3
3
|
import { preNormalizeEntry } from "../urlset/normalise.js";
|
|
4
4
|
import { childSitemapSources, globalSitemapSources, resolveSitemapSources } from "../urlset/sources.js";
|
|
5
5
|
import { sortInPlace } from "../urlset/sort.js";
|
|
6
|
-
import { applyDynamicParams, createPathFilter, findPageMapping, splitForLocales } from "../../../utils-pure.js";
|
|
6
|
+
import { applyDynamicParams, createPathFilter, findPageMapping, logger, splitForLocales } from "../../../utils-pure.js";
|
|
7
7
|
import { parseChunkInfo, sliceUrlsForChunk } from "../utils/chunk.js";
|
|
8
8
|
export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
|
|
9
9
|
const {
|
|
@@ -221,6 +221,21 @@ export async function buildSitemapUrls(sitemap, resolvers, runtimeConfig, nitro)
|
|
|
221
221
|
};
|
|
222
222
|
await nitro?.hooks.callHook("sitemap:input", resolvedCtx);
|
|
223
223
|
const enhancedUrls = resolveSitemapEntries(sitemap, resolvedCtx.urls, { autoI18n, isI18nMapped }, resolvers);
|
|
224
|
+
if (isMultiSitemap) {
|
|
225
|
+
const sitemapNames = Object.keys(sitemaps).filter((k) => k !== "index");
|
|
226
|
+
const warnedSitemaps = nitro?._sitemapWarnedSitemaps || /* @__PURE__ */ new Set();
|
|
227
|
+
for (const e of enhancedUrls) {
|
|
228
|
+
if (typeof e._sitemap === "string" && !sitemapNames.includes(e._sitemap)) {
|
|
229
|
+
if (!warnedSitemaps.has(e._sitemap)) {
|
|
230
|
+
warnedSitemaps.add(e._sitemap);
|
|
231
|
+
logger.error(`Sitemap \`${e._sitemap}\` not found in sitemap config. Available sitemaps: ${sitemapNames.join(", ")}. Entry \`${e.loc}\` will be omitted.`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (nitro) {
|
|
236
|
+
nitro._sitemapWarnedSitemaps = warnedSitemaps;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
224
239
|
const filteredUrls = enhancedUrls.filter((e) => {
|
|
225
240
|
if (e._sitemap === false)
|
|
226
241
|
return false;
|
|
@@ -79,6 +79,10 @@ function buildUrlXml(url, NL, I1, I2, I3, I4) {
|
|
|
79
79
|
if (url.news.publication_date) xml += `${I3}<news:publication_date>${url.news.publication_date}</news:publication_date>${NL}`;
|
|
80
80
|
xml += `${I2}</news:news>${NL}`;
|
|
81
81
|
}
|
|
82
|
+
if (import.meta.dev && url._warnings?.length) {
|
|
83
|
+
for (const w of url._warnings)
|
|
84
|
+
xml += `${I2}<!-- WARN: ${w} -->${NL}`;
|
|
85
|
+
}
|
|
82
86
|
xml += `${I1}</url>`;
|
|
83
87
|
return xml;
|
|
84
88
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { appendHeader, createError, getRouterParam, sendRedirect, setHeader } from "h3";
|
|
2
|
-
import { joinURL, withBase, withoutLeadingSlash, withoutTrailingSlash } from "ufo";
|
|
2
|
+
import { joinURL, withBase, withoutLeadingSlash, withoutTrailingSlash, withLeadingSlash } from "ufo";
|
|
3
3
|
import { useRuntimeConfig, useNitroApp } from "nitropack/runtime";
|
|
4
4
|
import { useSitemapRuntimeConfig } from "../utils.js";
|
|
5
5
|
import { createSitemap, useNitroUrlResolvers } from "./nitro.js";
|
|
@@ -53,13 +53,22 @@ export async function sitemapChildXmlEventHandler(e) {
|
|
|
53
53
|
let sitemapName = getRouterParam(e, "sitemap");
|
|
54
54
|
if (!sitemapName) {
|
|
55
55
|
const path = e.path;
|
|
56
|
-
const match = path.match(/(?:\/__sitemap__\/)?(
|
|
56
|
+
const match = path.match(/(?:\/__sitemap__\/)?(.+)\.xml$/);
|
|
57
57
|
if (match)
|
|
58
58
|
sitemapName = match[1];
|
|
59
59
|
}
|
|
60
60
|
if (!sitemapName)
|
|
61
61
|
throw createError({ statusCode: 400, message: "Invalid sitemap request" });
|
|
62
|
-
sitemapName =
|
|
62
|
+
sitemapName = sitemapName.replace(/\.xml$/, "");
|
|
63
|
+
sitemapName = withLeadingSlash(sitemapName);
|
|
64
|
+
if (sitemapName.startsWith("/__sitemap__/"))
|
|
65
|
+
sitemapName = sitemapName.replace("/__sitemap__/", "/");
|
|
66
|
+
if (runtimeConfig.sitemapsPathPrefix) {
|
|
67
|
+
const prefix = withLeadingSlash(runtimeConfig.sitemapsPathPrefix);
|
|
68
|
+
if (sitemapName.startsWith(prefix))
|
|
69
|
+
sitemapName = sitemapName.replace(prefix, "/");
|
|
70
|
+
}
|
|
71
|
+
sitemapName = withoutLeadingSlash(withoutTrailingSlash(sitemapName));
|
|
63
72
|
const chunkInfo = parseChunkInfo(sitemapName, sitemaps, runtimeConfig.defaultSitemapsChunkSize);
|
|
64
73
|
const isAutoChunked = typeof sitemaps.chunks !== "undefined" && !Number.isNaN(Number(sitemapName));
|
|
65
74
|
const sitemapExists = sitemapName in sitemaps || chunkInfo.baseSitemapName in sitemaps || isAutoChunked;
|