@nuxtjs/sitemap 7.3.1 → 7.4.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 +7 -8
- package/dist/client/404.html +7 -8
- package/dist/client/_nuxt/ChEizYIG.js +172 -0
- package/dist/client/_nuxt/{CT3BV8Rj.js → SQMF8ibg.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/048e1f4c-a575-4a94-bbab-d777afe4c585.json +1 -0
- package/dist/client/_nuxt/{5vafBU9X.js → cqJZcoo0.js} +1 -1
- package/dist/client/_nuxt/error-404.DljSaiyF.css +1 -0
- package/dist/client/_nuxt/error-500.DbX9fggi.css +1 -0
- package/dist/client/index.html +7 -8
- package/dist/module.cjs +28 -18
- package/dist/module.json +1 -1
- package/dist/module.mjs +28 -18
- package/dist/runtime/server/content-compat.d.ts +1 -0
- package/dist/runtime/server/content-compat.js +2 -0
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.d.ts +1 -1
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +4 -2
- package/dist/runtime/server/routes/sitemap.xsl.js +37 -13
- package/dist/runtime/server/routes/sitemap_index.xml.js +6 -2
- package/dist/runtime/server/sitemap/builder/sitemap-index.d.ts +11 -2
- package/dist/runtime/server/sitemap/builder/sitemap-index.js +23 -5
- package/dist/runtime/server/sitemap/builder/sitemap.d.ts +7 -1
- package/dist/runtime/server/sitemap/builder/sitemap.js +10 -5
- package/dist/runtime/server/sitemap/builder/xml.d.ts +4 -1
- package/dist/runtime/server/sitemap/builder/xml.js +13 -4
- package/dist/runtime/server/sitemap/nitro.js +7 -3
- package/dist/runtime/server/sitemap/urlset/normalise.js +4 -3
- package/dist/runtime/server/sitemap/urlset/sources.js +62 -17
- package/dist/runtime/server/utils.d.ts +1 -0
- package/dist/runtime/server/utils.js +3 -0
- package/dist/runtime/types.d.ts +1 -0
- package/package.json +11 -10
- package/dist/client/_nuxt/BIHI7g3E.js +0 -1
- package/dist/client/_nuxt/Bn78IMkz.js +0 -172
- package/dist/client/_nuxt/builds/meta/5ecca6e1-2b8a-4fc5-a128-35cbc27bf6d7.json +0 -1
- package/dist/client/_nuxt/error-404.D_zhMyJm.css +0 -1
- package/dist/client/_nuxt/error-500.rdOYVbxo.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as s,u as a,c as i,o as u,a as e,t as o}from"./
|
|
1
|
+
import{_ as s,u as a,c as i,o as u,a as e,t as o}from"./ChEizYIG.js";const l={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},c={class:"max-w-520px text-center"},d=["textContent"],p=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const n=t;return a({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(g,r)=>(u(),i("div",l,[r[0]||(r[0]=e("div",{class:"-bottom-1/2 fixed h-1/2 left-0 right-0 spotlight"},null,-1)),e("div",c,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:o(t.statusCode)},null,8,d),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:o(t.description)},null,8,p)])]))}},m=s(f,[["__scopeId","data-v-e5e99abb"]]);export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"048e1f4c-a575-4a94-bbab-d777afe4c585","timestamp":1749875586228}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"048e1f4c-a575-4a94-bbab-d777afe4c585","timestamp":1749875586228,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as a,u as i,c as u,o as c,a as e,t as r,b as l,w as d,d as p,e as f}from"./
|
|
1
|
+
import{_ as a,u as i,c as u,o as c,a as e,t as r,b as l,w as d,d as p,e as f}from"./ChEizYIG.js";const m={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},g={class:"max-w-520px text-center z-20"},b=["textContent"],h=["textContent"],x={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const n=t;return i({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(k,o)=>{const s=f;return c(),u("div",m,[o[0]||(o[0]=e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),e("div",g,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:r(t.statusCode)},null,8,b),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:r(t.description)},null,8,h),e("div",x,[l(s,{to:"/",class:"cursor-pointer gradient-border px-4 py-2 sm:px-6 sm:py-3 sm:text-xl text-md"},{default:d(()=>[p(r(t.backHome),1)]),_:1})])])])}}},_=a(y,[["__scopeId","data-v-cbd89f5b"]]);export{_ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spotlight[data-v-cbd89f5b]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-cbd89f5b]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-cbd89f5b]{background-color:#ffffff4d}.gradient-border[data-v-cbd89f5b]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-cbd89f5b]{background-color:#1414144d}.gradient-border[data-v-cbd89f5b]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-cbd89f5b]:before{background-size:400% auto;border-radius:.5rem;bottom:0;content:"";left:0;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.5;padding:2px;position:absolute;right:0;top:0;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-cbd89f5b]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-cbd89f5b]{position:fixed}.left-0[data-v-cbd89f5b]{left:0}.right-0[data-v-cbd89f5b]{right:0}.z-10[data-v-cbd89f5b]{z-index:10}.z-20[data-v-cbd89f5b]{z-index:20}.grid[data-v-cbd89f5b]{display:grid}.mb-16[data-v-cbd89f5b]{margin-bottom:4rem}.mb-8[data-v-cbd89f5b]{margin-bottom:2rem}.max-w-520px[data-v-cbd89f5b]{max-width:520px}.min-h-screen[data-v-cbd89f5b]{min-height:100vh}.w-full[data-v-cbd89f5b]{width:100%}.flex[data-v-cbd89f5b]{display:flex}.cursor-pointer[data-v-cbd89f5b]{cursor:pointer}.place-content-center[data-v-cbd89f5b]{place-content:center}.items-center[data-v-cbd89f5b]{align-items:center}.justify-center[data-v-cbd89f5b]{justify-content:center}.overflow-hidden[data-v-cbd89f5b]{overflow:hidden}.bg-white[data-v-cbd89f5b]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-cbd89f5b]{padding-left:1rem;padding-right:1rem}.px-8[data-v-cbd89f5b]{padding-left:2rem;padding-right:2rem}.py-2[data-v-cbd89f5b]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-cbd89f5b]{text-align:center}.text-8xl[data-v-cbd89f5b]{font-size:6rem;line-height:1}.text-xl[data-v-cbd89f5b]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-cbd89f5b]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-cbd89f5b]{font-weight:300}.font-medium[data-v-cbd89f5b]{font-weight:500}.leading-tight[data-v-cbd89f5b]{line-height:1.25}.font-sans[data-v-cbd89f5b]{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}.antialiased[data-v-cbd89f5b]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-cbd89f5b]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-cbd89f5b]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-cbd89f5b]{padding-left:0;padding-right:0}.sm\:px-6[data-v-cbd89f5b]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-cbd89f5b]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-cbd89f5b]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-cbd89f5b]{font-size:1.25rem;line-height:1.75rem}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spotlight[data-v-e5e99abb]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-e5e99abb]{position:fixed}.-bottom-1\/2[data-v-e5e99abb]{bottom:-50%}.left-0[data-v-e5e99abb]{left:0}.right-0[data-v-e5e99abb]{right:0}.grid[data-v-e5e99abb]{display:grid}.mb-16[data-v-e5e99abb]{margin-bottom:4rem}.mb-8[data-v-e5e99abb]{margin-bottom:2rem}.h-1\/2[data-v-e5e99abb]{height:50%}.max-w-520px[data-v-e5e99abb]{max-width:520px}.min-h-screen[data-v-e5e99abb]{min-height:100vh}.place-content-center[data-v-e5e99abb]{place-content:center}.overflow-hidden[data-v-e5e99abb]{overflow:hidden}.bg-white[data-v-e5e99abb]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-e5e99abb]{padding-left:2rem;padding-right:2rem}.text-center[data-v-e5e99abb]{text-align:center}.text-8xl[data-v-e5e99abb]{font-size:6rem;line-height:1}.text-xl[data-v-e5e99abb]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-e5e99abb]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-e5e99abb]{font-weight:300}.font-medium[data-v-e5e99abb]{font-weight:500}.leading-tight[data-v-e5e99abb]{line-height:1.25}.font-sans[data-v-e5e99abb]{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}.antialiased[data-v-e5e99abb]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-e5e99abb]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-e5e99abb]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-e5e99abb]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-e5e99abb]{font-size:2.25rem;line-height:2.5rem}}
|
package/dist/client/index.html
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
<!DOCTYPE html><html><head><meta charset="utf-8">
|
|
2
2
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
3
3
|
<link rel="stylesheet" href="/__sitemap__/devtools/_nuxt/entry.BzbtAPc0.css" crossorigin>
|
|
4
|
-
<link rel="modulepreload" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/
|
|
5
|
-
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/BIHI7g3E.js">
|
|
4
|
+
<link rel="modulepreload" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/ChEizYIG.js">
|
|
6
5
|
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/CVO1_9PV.js">
|
|
7
6
|
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/D0r3Knsf.js">
|
|
8
7
|
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/Cp-IABpG.js">
|
|
9
|
-
<link rel="prefetch" as="style" crossorigin href="/__sitemap__/devtools/_nuxt/error-404.
|
|
10
|
-
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/
|
|
11
|
-
<link rel="prefetch" as="style" crossorigin href="/__sitemap__/devtools/_nuxt/error-500.
|
|
12
|
-
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/
|
|
13
|
-
<script type="module" src="/__sitemap__/devtools/_nuxt/
|
|
14
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildId:"
|
|
8
|
+
<link rel="prefetch" as="style" crossorigin href="/__sitemap__/devtools/_nuxt/error-404.DljSaiyF.css">
|
|
9
|
+
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/cqJZcoo0.js">
|
|
10
|
+
<link rel="prefetch" as="style" crossorigin href="/__sitemap__/devtools/_nuxt/error-500.DbX9fggi.css">
|
|
11
|
+
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/SQMF8ibg.js">
|
|
12
|
+
<script type="module" src="/__sitemap__/devtools/_nuxt/ChEizYIG.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1749875588506,false]</script>
|
|
13
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildId:"048e1f4c-a575-4a94-bbab-d777afe4c585",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.cjs
CHANGED
|
@@ -20,13 +20,19 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
20
20
|
const chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
21
21
|
|
|
22
22
|
async function resolveUrls(urls, ctx) {
|
|
23
|
-
|
|
24
|
-
urls
|
|
25
|
-
|
|
23
|
+
try {
|
|
24
|
+
if (typeof urls === "function")
|
|
25
|
+
urls = urls();
|
|
26
|
+
urls = await urls;
|
|
27
|
+
} catch (e) {
|
|
28
|
+
ctx.logger.error(`Failed to resolve ${typeof urls} urls.`);
|
|
29
|
+
ctx.logger.error(e);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
26
32
|
try {
|
|
27
33
|
urls = JSON.parse(JSON.stringify(urls));
|
|
28
34
|
} catch (e) {
|
|
29
|
-
ctx.logger.
|
|
35
|
+
ctx.logger.error(`Failed to serialize ${typeof urls} \`${ctx.path}\`, please make sure that the urls resolve as a valid array without circular dependencies.`);
|
|
30
36
|
ctx.logger.error(e);
|
|
31
37
|
return [];
|
|
32
38
|
}
|
|
@@ -405,7 +411,7 @@ function includesSitemapRoot(sitemapName, routes) {
|
|
|
405
411
|
return routes.includes(`/__sitemap__/`) || routes.includes(`/sitemap.xml`) || routes.includes(`/${sitemapName}`) || routes.includes("/sitemap_index.xml");
|
|
406
412
|
}
|
|
407
413
|
function isNuxtGenerate(nuxt = kit.useNuxt()) {
|
|
408
|
-
return nuxt.options._generate || [
|
|
414
|
+
return nuxt.options.nitro.static || nuxt.options._generate || [
|
|
409
415
|
"static",
|
|
410
416
|
"github-pages"
|
|
411
417
|
].includes(resolveNitroPreset());
|
|
@@ -419,8 +425,17 @@ function setupPrerenderHandler(_options, nuxt = kit.useNuxt()) {
|
|
|
419
425
|
logger.warn("Runtime sitemaps are not supported on Vercel Edge, falling back to prerendering sitemaps.");
|
|
420
426
|
prerenderSitemap = true;
|
|
421
427
|
}
|
|
422
|
-
|
|
423
|
-
|
|
428
|
+
nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
|
|
429
|
+
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
|
|
430
|
+
const shouldHookIntoPrerender = prerenderSitemap || nuxt.options.nitro.prerender.routes.length && nuxt.options.nitro.prerender.crawlLinks;
|
|
431
|
+
if (isNuxtGenerate() && options.debug) {
|
|
432
|
+
nuxt.options.nitro.prerender.routes.push("/__sitemap__/debug.json");
|
|
433
|
+
logger.info("Adding debug route for sitemap generation:", chalk__default.cyan("/__sitemap__/debug.json"));
|
|
434
|
+
}
|
|
435
|
+
if (!shouldHookIntoPrerender) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes.filter((r) => r && !includesSitemapRoot(options.sitemapName, [r]));
|
|
424
439
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
425
440
|
let prerenderer;
|
|
426
441
|
nitro.hooks.hook("prerender:init", async (_prerenderer) => {
|
|
@@ -468,16 +483,7 @@ function setupPrerenderHandler(_options, nuxt = kit.useNuxt()) {
|
|
|
468
483
|
return;
|
|
469
484
|
}
|
|
470
485
|
await nitroModule.build(prerenderer);
|
|
471
|
-
|
|
472
|
-
if (options.debug)
|
|
473
|
-
routes.push("/__sitemap__/debug.json");
|
|
474
|
-
if (prerenderSitemap) {
|
|
475
|
-
routes.push(
|
|
476
|
-
options.isMultiSitemap ? "/sitemap_index.xml" : `/${Object.keys(options.sitemaps)[0]}`
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
for (const route of routes)
|
|
480
|
-
await prerenderRoute(nitro, route);
|
|
486
|
+
await prerenderRoute(nitro, options.isMultiSitemap ? "/sitemap_index.xml" : `/${Object.keys(options.sitemaps)[0]}`);
|
|
481
487
|
});
|
|
482
488
|
});
|
|
483
489
|
}
|
|
@@ -901,7 +907,11 @@ declare module 'vue-router' {
|
|
|
901
907
|
logger.warn("You have loaded `@nuxt/content` before `@nuxtjs/sitemap`, this may cause issues with the integration. Please ensure `@nuxtjs/sitemap` is loaded first.");
|
|
902
908
|
}
|
|
903
909
|
config.exclude.push("/__nuxt_content/**");
|
|
904
|
-
|
|
910
|
+
const needsCustomAlias = await kit.hasNuxtModuleCompatibility("@nuxt/content", "<3.6.0");
|
|
911
|
+
if (needsCustomAlias) {
|
|
912
|
+
nuxt.options.alias["#sitemap/content-v3-nitro-path"] = resolve(pathe.dirname(kit.resolveModule("@nuxt/content")), "runtime/nitro");
|
|
913
|
+
nuxt.options.alias["@nuxt/content/nitro"] = resolve("./runtime/server/content-compat");
|
|
914
|
+
}
|
|
905
915
|
nuxt.hooks.hook("content:file:afterParse", (ctx) => {
|
|
906
916
|
const content = ctx.content;
|
|
907
917
|
nuxtV3Collections.add(ctx.collection.name);
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -13,13 +13,19 @@ import chalk from 'chalk';
|
|
|
13
13
|
import { normaliseDate } from '../dist/runtime/server/sitemap/urlset/normalise.js';
|
|
14
14
|
|
|
15
15
|
async function resolveUrls(urls, ctx) {
|
|
16
|
-
|
|
17
|
-
urls
|
|
18
|
-
|
|
16
|
+
try {
|
|
17
|
+
if (typeof urls === "function")
|
|
18
|
+
urls = urls();
|
|
19
|
+
urls = await urls;
|
|
20
|
+
} catch (e) {
|
|
21
|
+
ctx.logger.error(`Failed to resolve ${typeof urls} urls.`);
|
|
22
|
+
ctx.logger.error(e);
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
19
25
|
try {
|
|
20
26
|
urls = JSON.parse(JSON.stringify(urls));
|
|
21
27
|
} catch (e) {
|
|
22
|
-
ctx.logger.
|
|
28
|
+
ctx.logger.error(`Failed to serialize ${typeof urls} \`${ctx.path}\`, please make sure that the urls resolve as a valid array without circular dependencies.`);
|
|
23
29
|
ctx.logger.error(e);
|
|
24
30
|
return [];
|
|
25
31
|
}
|
|
@@ -398,7 +404,7 @@ function includesSitemapRoot(sitemapName, routes) {
|
|
|
398
404
|
return routes.includes(`/__sitemap__/`) || routes.includes(`/sitemap.xml`) || routes.includes(`/${sitemapName}`) || routes.includes("/sitemap_index.xml");
|
|
399
405
|
}
|
|
400
406
|
function isNuxtGenerate(nuxt = useNuxt()) {
|
|
401
|
-
return nuxt.options._generate || [
|
|
407
|
+
return nuxt.options.nitro.static || nuxt.options._generate || [
|
|
402
408
|
"static",
|
|
403
409
|
"github-pages"
|
|
404
410
|
].includes(resolveNitroPreset());
|
|
@@ -412,8 +418,17 @@ function setupPrerenderHandler(_options, nuxt = useNuxt()) {
|
|
|
412
418
|
logger.warn("Runtime sitemaps are not supported on Vercel Edge, falling back to prerendering sitemaps.");
|
|
413
419
|
prerenderSitemap = true;
|
|
414
420
|
}
|
|
415
|
-
|
|
416
|
-
|
|
421
|
+
nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
|
|
422
|
+
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
|
|
423
|
+
const shouldHookIntoPrerender = prerenderSitemap || nuxt.options.nitro.prerender.routes.length && nuxt.options.nitro.prerender.crawlLinks;
|
|
424
|
+
if (isNuxtGenerate() && options.debug) {
|
|
425
|
+
nuxt.options.nitro.prerender.routes.push("/__sitemap__/debug.json");
|
|
426
|
+
logger.info("Adding debug route for sitemap generation:", chalk.cyan("/__sitemap__/debug.json"));
|
|
427
|
+
}
|
|
428
|
+
if (!shouldHookIntoPrerender) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes.filter((r) => r && !includesSitemapRoot(options.sitemapName, [r]));
|
|
417
432
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
418
433
|
let prerenderer;
|
|
419
434
|
nitro.hooks.hook("prerender:init", async (_prerenderer) => {
|
|
@@ -461,16 +476,7 @@ function setupPrerenderHandler(_options, nuxt = useNuxt()) {
|
|
|
461
476
|
return;
|
|
462
477
|
}
|
|
463
478
|
await nitroModule.build(prerenderer);
|
|
464
|
-
|
|
465
|
-
if (options.debug)
|
|
466
|
-
routes.push("/__sitemap__/debug.json");
|
|
467
|
-
if (prerenderSitemap) {
|
|
468
|
-
routes.push(
|
|
469
|
-
options.isMultiSitemap ? "/sitemap_index.xml" : `/${Object.keys(options.sitemaps)[0]}`
|
|
470
|
-
);
|
|
471
|
-
}
|
|
472
|
-
for (const route of routes)
|
|
473
|
-
await prerenderRoute(nitro, route);
|
|
479
|
+
await prerenderRoute(nitro, options.isMultiSitemap ? "/sitemap_index.xml" : `/${Object.keys(options.sitemaps)[0]}`);
|
|
474
480
|
});
|
|
475
481
|
});
|
|
476
482
|
}
|
|
@@ -894,7 +900,11 @@ declare module 'vue-router' {
|
|
|
894
900
|
logger.warn("You have loaded `@nuxt/content` before `@nuxtjs/sitemap`, this may cause issues with the integration. Please ensure `@nuxtjs/sitemap` is loaded first.");
|
|
895
901
|
}
|
|
896
902
|
config.exclude.push("/__nuxt_content/**");
|
|
897
|
-
|
|
903
|
+
const needsCustomAlias = await hasNuxtModuleCompatibility("@nuxt/content", "<3.6.0");
|
|
904
|
+
if (needsCustomAlias) {
|
|
905
|
+
nuxt.options.alias["#sitemap/content-v3-nitro-path"] = resolve(dirname(resolveModule("@nuxt/content")), "runtime/nitro");
|
|
906
|
+
nuxt.options.alias["@nuxt/content/nitro"] = resolve("./runtime/server/content-compat");
|
|
907
|
+
}
|
|
898
908
|
nuxt.hooks.hook("content:file:afterParse", (ctx) => {
|
|
899
909
|
const content = ctx.content;
|
|
900
910
|
nuxtV3Collections.add(ctx.collection.name);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const queryCollection: any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
|
|
1
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any[]>>;
|
|
2
2
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineEventHandler } from "h3";
|
|
2
|
-
import {
|
|
2
|
+
import { queryCollection } from "@nuxt/content/nitro";
|
|
3
3
|
import manifest from "#content/manifest";
|
|
4
4
|
export default defineEventHandler(async (e) => {
|
|
5
5
|
const collections = [];
|
|
@@ -10,7 +10,9 @@ export default defineEventHandler(async (e) => {
|
|
|
10
10
|
}
|
|
11
11
|
const contentList = [];
|
|
12
12
|
for (const collection of collections) {
|
|
13
|
-
contentList.push(
|
|
13
|
+
contentList.push(
|
|
14
|
+
queryCollection(e, collection).select("path", "sitemap").where("path", "IS NOT NULL").where("sitemap", "IS NOT NULL").all()
|
|
15
|
+
);
|
|
14
16
|
}
|
|
15
17
|
const results = await Promise.all(contentList);
|
|
16
18
|
return results.flatMap((c) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineEventHandler, getHeader, setHeader } from "h3";
|
|
1
|
+
import { defineEventHandler, getHeader, setHeader, getQuery as h3GetQuery } from "h3";
|
|
2
2
|
import { getQuery, parseURL, withQuery } from "ufo";
|
|
3
|
-
import { useSitemapRuntimeConfig } from "../utils.js";
|
|
3
|
+
import { useSitemapRuntimeConfig, xmlEscape } from "../utils.js";
|
|
4
4
|
import { useSiteConfig } from "#site-config/server/composables/useSiteConfig";
|
|
5
5
|
import { createSitePathResolver } from "#site-config/server/composables/utils";
|
|
6
6
|
export default defineEventHandler(async (e) => {
|
|
@@ -23,17 +23,37 @@ export default defineEventHandler(async (e) => {
|
|
|
23
23
|
const isShowingCanonical = typeof canonicalQuery !== "undefined" && canonicalQuery !== "false";
|
|
24
24
|
const conditionalTips = [
|
|
25
25
|
'You are looking at a <a href="https://developer.mozilla.org/en-US/docs/Web/XSLT/Transforming_XML_with_XSLT/An_Overview" style="color: #398465" target="_blank">XML stylesheet</a>. Read the <a href="https://nuxtseo.com/sitemap/guides/customising-ui" style="color: #398465" target="_blank">docs</a> to learn how to customize it. View the page source to see the raw XML.',
|
|
26
|
-
`URLs missing? Check Nuxt Devtools Sitemap tab (or the <a href="${withQuery("/__sitemap__/debug.json", { sitemap: sitemapName })}" style="color: #398465" target="_blank">debug endpoint</a>).`
|
|
26
|
+
`URLs missing? Check Nuxt Devtools Sitemap tab (or the <a href="${xmlEscape(withQuery("/__sitemap__/debug.json", { sitemap: sitemapName }))}" style="color: #398465" target="_blank">debug endpoint</a>).`
|
|
27
27
|
];
|
|
28
|
+
const fetchErrors = [];
|
|
29
|
+
const xslQuery = h3GetQuery(e);
|
|
30
|
+
if (xslQuery.error_messages) {
|
|
31
|
+
const errorMessages = xslQuery.error_messages;
|
|
32
|
+
const errorUrls = xslQuery.error_urls;
|
|
33
|
+
if (errorMessages) {
|
|
34
|
+
const messages = Array.isArray(errorMessages) ? errorMessages : [errorMessages];
|
|
35
|
+
const urls = Array.isArray(errorUrls) ? errorUrls : errorUrls ? [errorUrls] : [];
|
|
36
|
+
messages.forEach((msg, i) => {
|
|
37
|
+
const errorParts = [xmlEscape(msg)];
|
|
38
|
+
if (urls[i]) {
|
|
39
|
+
errorParts.push(xmlEscape(urls[i]));
|
|
40
|
+
}
|
|
41
|
+
fetchErrors.push(`<strong style="color: #dc2626;">Error ${i + 1}:</strong> ${errorParts.join(" - ")}`);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
28
45
|
if (!isShowingCanonical) {
|
|
29
46
|
const canonicalPreviewUrl = withQuery(referrer, { canonical: "" });
|
|
30
|
-
conditionalTips.push(`Your canonical site URL is <strong>${siteUrl}</strong>.`);
|
|
31
|
-
conditionalTips.push(`You can preview your canonical sitemap by visiting <a href="${canonicalPreviewUrl}" style="color: #398465; white-space: nowrap;">${fixPath(canonicalPreviewUrl)}?canonical</a>`);
|
|
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>`);
|
|
32
49
|
} else {
|
|
33
|
-
conditionalTips.push(`You are viewing the canonical sitemap. You can switch to using the request origin: <a href="${fixPath(referrer)}" style="color: #398465; white-space: nowrap ">${fixPath(referrer)}</a>`);
|
|
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>`);
|
|
34
51
|
}
|
|
35
|
-
const
|
|
36
|
-
const
|
|
52
|
+
const hasRuntimeErrors = fetchErrors.length > 0;
|
|
53
|
+
const showDevTips = import.meta.dev && xslTips !== false;
|
|
54
|
+
const showSidebar = showDevTips || hasRuntimeErrors;
|
|
55
|
+
const devTips = showDevTips ? conditionalTips.map((t) => `<li><p>${t}</p></li>`).join("\n") : "";
|
|
56
|
+
const runtimeErrors = hasRuntimeErrors ? fetchErrors.map((t) => `<li><p>${t}</p></li>`).join("\n") : "";
|
|
37
57
|
let columns = [...xslColumns];
|
|
38
58
|
if (!columns.length) {
|
|
39
59
|
columns = [
|
|
@@ -97,12 +117,12 @@ export default defineEventHandler(async (e) => {
|
|
|
97
117
|
}
|
|
98
118
|
|
|
99
119
|
.expl a {
|
|
100
|
-
color: #398465
|
|
120
|
+
color: #398465;
|
|
101
121
|
font-weight: 600;
|
|
102
122
|
}
|
|
103
123
|
|
|
104
124
|
.expl a:visited {
|
|
105
|
-
color: #398465
|
|
125
|
+
color: #398465;
|
|
106
126
|
}
|
|
107
127
|
|
|
108
128
|
a {
|
|
@@ -153,8 +173,8 @@ export default defineEventHandler(async (e) => {
|
|
|
153
173
|
<div>
|
|
154
174
|
<div id="content">
|
|
155
175
|
<h1 class="text-2xl mb-3">XML Sitemap</h1>
|
|
156
|
-
<h2>${title}</h2>
|
|
157
|
-
${isNotIndexButHasIndex ? `<p style="font-size: 12px; margin-bottom: 1rem;"><a href="${fixPath("/sitemap_index.xml")}">${fixPath("/sitemap_index.xml")}</a></p>` : ""}
|
|
176
|
+
<h2>${xmlEscape(title)}</h2>
|
|
177
|
+
${isNotIndexButHasIndex ? `<p style="font-size: 12px; margin-bottom: 1rem;"><a href="${xmlEscape(fixPath("/sitemap_index.xml"))}">${xmlEscape(fixPath("/sitemap_index.xml"))}</a></p>` : ""}
|
|
158
178
|
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) > 0">
|
|
159
179
|
<p class="expl" style="margin-bottom: 1rem;">
|
|
160
180
|
This XML Sitemap Index file contains
|
|
@@ -221,7 +241,11 @@ export default defineEventHandler(async (e) => {
|
|
|
221
241
|
</xsl:if>
|
|
222
242
|
</div>
|
|
223
243
|
</div>
|
|
224
|
-
${
|
|
244
|
+
${showSidebar ? `<div class="w-30 top-2 shadow rounded p-5 right-2" style="margin: 0 auto;">
|
|
245
|
+
${showDevTips ? `<div><p><strong>Development Tips</strong></p><ul style="margin: 1rem 0; padding: 0;">${devTips}</ul></div>` : ""}
|
|
246
|
+
${hasRuntimeErrors ? `<div${showDevTips ? ' style="margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #e5e7eb;"' : ""}><p><strong style="color: #dc2626;">Runtime Errors</strong></p><ul style="margin: 1rem 0; padding: 0;">${runtimeErrors}</ul></div>` : ""}
|
|
247
|
+
${showDevTips ? `<p style="margin-top: 1rem;">${creditName}</p>` : ""}
|
|
248
|
+
</div>` : ""}
|
|
225
249
|
</div>
|
|
226
250
|
</body>
|
|
227
251
|
</html>
|
|
@@ -8,7 +8,7 @@ export default defineEventHandler(async (e) => {
|
|
|
8
8
|
const runtimeConfig = useSitemapRuntimeConfig();
|
|
9
9
|
const nitro = useNitroApp();
|
|
10
10
|
const resolvers = useNitroUrlResolvers(e);
|
|
11
|
-
const sitemaps = await buildSitemapIndex(resolvers, runtimeConfig, nitro);
|
|
11
|
+
const { entries: sitemaps, failedSources } = await buildSitemapIndex(resolvers, runtimeConfig, nitro);
|
|
12
12
|
if (import.meta.prerender) {
|
|
13
13
|
appendHeader(
|
|
14
14
|
e,
|
|
@@ -18,7 +18,11 @@ export default defineEventHandler(async (e) => {
|
|
|
18
18
|
}
|
|
19
19
|
const indexResolvedCtx = { sitemaps, event: e };
|
|
20
20
|
await nitro.hooks.callHook("sitemap:index-resolved", indexResolvedCtx);
|
|
21
|
-
const
|
|
21
|
+
const errorInfo = failedSources.length > 0 ? {
|
|
22
|
+
messages: failedSources.map((f) => f.error),
|
|
23
|
+
urls: failedSources.map((f) => f.url)
|
|
24
|
+
} : void 0;
|
|
25
|
+
const output = urlsToIndexXml(indexResolvedCtx.sitemaps, resolvers, runtimeConfig, errorInfo);
|
|
22
26
|
const ctx = { sitemap: output, sitemapName: "sitemap", event: e };
|
|
23
27
|
await nitro.hooks.callHook("sitemap:output", ctx);
|
|
24
28
|
setHeader(e, "Content-Type", "text/xml; charset=UTF-8");
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { NitroApp } from 'nitropack/types';
|
|
2
2
|
import type { ModuleRuntimeConfig, NitroUrlResolvers, SitemapIndexEntry } from '../../../types.js';
|
|
3
|
-
export declare function urlsToIndexXml(sitemaps: SitemapIndexEntry[], resolvers: NitroUrlResolvers, { version, xsl, credits, minify }: Pick<ModuleRuntimeConfig, 'version' | 'xsl' | 'credits' | 'minify'
|
|
4
|
-
|
|
3
|
+
export declare function urlsToIndexXml(sitemaps: SitemapIndexEntry[], resolvers: NitroUrlResolvers, { version, xsl, credits, minify }: Pick<ModuleRuntimeConfig, 'version' | 'xsl' | 'credits' | 'minify'>, errorInfo?: {
|
|
4
|
+
messages: string[];
|
|
5
|
+
urls: string[];
|
|
6
|
+
}): string;
|
|
7
|
+
export declare function buildSitemapIndex(resolvers: NitroUrlResolvers, runtimeConfig: ModuleRuntimeConfig, nitro?: NitroApp): Promise<{
|
|
8
|
+
entries: SitemapIndexEntry[];
|
|
9
|
+
failedSources: Array<{
|
|
10
|
+
url: string;
|
|
11
|
+
error: string;
|
|
12
|
+
}>;
|
|
13
|
+
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defu } from "defu";
|
|
2
|
-
import { joinURL } from "ufo";
|
|
2
|
+
import { joinURL, withQuery } from "ufo";
|
|
3
3
|
import { defineCachedFunction } from "nitropack/runtime";
|
|
4
4
|
import { getHeader } from "h3";
|
|
5
5
|
import { normaliseDate } from "../urlset/normalise.js";
|
|
@@ -45,6 +45,7 @@ async function buildSitemapIndexInternal(resolvers, runtimeConfig, nitro) {
|
|
|
45
45
|
return sortEntries ? sortInPlace(urls) : urls;
|
|
46
46
|
}
|
|
47
47
|
const chunks = {};
|
|
48
|
+
const allFailedSources = [];
|
|
48
49
|
for (const sitemapName in sitemaps) {
|
|
49
50
|
if (sitemapName === "index" || sitemapName === "chunks") continue;
|
|
50
51
|
const sitemapConfig = sitemaps[sitemapName];
|
|
@@ -68,6 +69,11 @@ async function buildSitemapIndexInternal(resolvers, runtimeConfig, nitro) {
|
|
|
68
69
|
sourcesInput = ctx.sources;
|
|
69
70
|
}
|
|
70
71
|
const sources = await resolveSitemapSources(sourcesInput, resolvers.event);
|
|
72
|
+
const failedSources = sources.filter((source) => source.error && source._isFailure).map((source) => ({
|
|
73
|
+
url: typeof source.fetch === "string" ? source.fetch : source.fetch?.[0] || "unknown",
|
|
74
|
+
error: source.error || "Unknown error"
|
|
75
|
+
}));
|
|
76
|
+
allFailedSources.push(...failedSources);
|
|
71
77
|
const resolvedCtx = {
|
|
72
78
|
urls: sources.flatMap((s) => s.urls),
|
|
73
79
|
sitemapName: sitemap.sitemapName,
|
|
@@ -113,6 +119,11 @@ async function buildSitemapIndexInternal(resolvers, runtimeConfig, nitro) {
|
|
|
113
119
|
sourcesInput = ctx.sources;
|
|
114
120
|
}
|
|
115
121
|
const sources = await resolveSitemapSources(sourcesInput, resolvers.event);
|
|
122
|
+
const failedSources = sources.filter((source) => source.error && source._isFailure).map((source) => ({
|
|
123
|
+
url: typeof source.fetch === "string" ? source.fetch : source.fetch?.[0] || "unknown",
|
|
124
|
+
error: source.error || "Unknown error"
|
|
125
|
+
}));
|
|
126
|
+
allFailedSources.push(...failedSources);
|
|
116
127
|
const resolvedCtx = {
|
|
117
128
|
urls: sources.flatMap((s) => s.urls),
|
|
118
129
|
sitemapName: sitemapConfig.sitemapName,
|
|
@@ -144,9 +155,9 @@ async function buildSitemapIndexInternal(resolvers, runtimeConfig, nitro) {
|
|
|
144
155
|
return typeof entry === "string" ? { sitemap: entry } : entry;
|
|
145
156
|
}));
|
|
146
157
|
}
|
|
147
|
-
return entries;
|
|
158
|
+
return { entries, failedSources: allFailedSources };
|
|
148
159
|
}
|
|
149
|
-
export function urlsToIndexXml(sitemaps, resolvers, { version, xsl, credits, minify }) {
|
|
160
|
+
export function urlsToIndexXml(sitemaps, resolvers, { version, xsl, credits, minify }, errorInfo) {
|
|
150
161
|
const sitemapXml = sitemaps.map((e) => [
|
|
151
162
|
" <sitemap>",
|
|
152
163
|
` <loc>${escapeValueForXml(e.sitemap)}</loc>`,
|
|
@@ -158,7 +169,14 @@ export function urlsToIndexXml(sitemaps, resolvers, { version, xsl, credits, min
|
|
|
158
169
|
'<?xml version="1.0" encoding="UTF-8"?>'
|
|
159
170
|
];
|
|
160
171
|
if (xsl) {
|
|
161
|
-
|
|
172
|
+
let relativeBaseUrl = resolvers.relativeBaseUrlResolver?.(xsl) ?? xsl;
|
|
173
|
+
if (errorInfo && errorInfo.messages.length > 0) {
|
|
174
|
+
relativeBaseUrl = withQuery(relativeBaseUrl, {
|
|
175
|
+
errors: "true",
|
|
176
|
+
error_messages: errorInfo.messages,
|
|
177
|
+
error_urls: errorInfo.urls
|
|
178
|
+
});
|
|
179
|
+
}
|
|
162
180
|
xmlParts.push(`<?xml-stylesheet type="text/xsl" href="${escapeValueForXml(relativeBaseUrl)}"?>`);
|
|
163
181
|
}
|
|
164
182
|
xmlParts.push(
|
|
@@ -172,7 +190,7 @@ export function urlsToIndexXml(sitemaps, resolvers, { version, xsl, credits, min
|
|
|
172
190
|
return minify ? xmlParts.join("").replace(/(?<!<[^>]*)\s(?![^<]*>)/g, "") : xmlParts.join("\n");
|
|
173
191
|
}
|
|
174
192
|
export async function buildSitemapIndex(resolvers, runtimeConfig, nitro) {
|
|
175
|
-
if (!import.meta.dev &&
|
|
193
|
+
if (!import.meta.dev && typeof runtimeConfig.cacheMaxAgeSeconds === "number" && runtimeConfig.cacheMaxAgeSeconds > 0 && resolvers.event) {
|
|
176
194
|
return buildSitemapIndexCached(resolvers.event, resolvers, runtimeConfig, nitro);
|
|
177
195
|
}
|
|
178
196
|
return buildSitemapIndexInternal(resolvers, runtimeConfig, nitro);
|
|
@@ -6,5 +6,11 @@ export interface NormalizedI18n extends ResolvedSitemapUrl {
|
|
|
6
6
|
_index?: number;
|
|
7
7
|
}
|
|
8
8
|
export declare function resolveSitemapEntries(sitemap: SitemapDefinition, urls: SitemapUrlInput[], runtimeConfig: Pick<ModuleRuntimeConfig, 'autoI18n' | 'isI18nMapped'>, resolvers?: NitroUrlResolvers): ResolvedSitemapUrl[];
|
|
9
|
-
export declare function buildSitemapUrls(sitemap: SitemapDefinition, resolvers: NitroUrlResolvers, runtimeConfig: ModuleRuntimeConfig, nitro?: NitroApp): Promise<
|
|
9
|
+
export declare function buildSitemapUrls(sitemap: SitemapDefinition, resolvers: NitroUrlResolvers, runtimeConfig: ModuleRuntimeConfig, nitro?: NitroApp): Promise<{
|
|
10
|
+
urls: ResolvedSitemapUrl[];
|
|
11
|
+
failedSources: Array<{
|
|
12
|
+
url: string;
|
|
13
|
+
error: string;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
10
16
|
export { urlsToXml } from './xml.js';
|
|
@@ -182,11 +182,11 @@ export async function buildSitemapUrls(sitemap, resolvers, runtimeConfig, nitro)
|
|
|
182
182
|
defaultSitemapsChunkSize
|
|
183
183
|
} = runtimeConfig;
|
|
184
184
|
const chunkInfo = parseChunkInfo(sitemap.sitemapName, sitemaps, defaultSitemapsChunkSize);
|
|
185
|
-
function maybeSort(
|
|
186
|
-
return sortEntries ? sortInPlace(
|
|
185
|
+
function maybeSort(urls2) {
|
|
186
|
+
return sortEntries ? sortInPlace(urls2) : urls2;
|
|
187
187
|
}
|
|
188
|
-
function maybeSlice(
|
|
189
|
-
return sliceUrlsForChunk(
|
|
188
|
+
function maybeSlice(urls2) {
|
|
189
|
+
return sliceUrlsForChunk(urls2, sitemap.sitemapName, sitemaps, defaultSitemapsChunkSize);
|
|
190
190
|
}
|
|
191
191
|
if (autoI18n?.differentDomains) {
|
|
192
192
|
const domain = autoI18n.locales.find((e) => [e.language, e.code].includes(sitemap.sitemapName))?.domain;
|
|
@@ -218,6 +218,10 @@ export async function buildSitemapUrls(sitemap, resolvers, runtimeConfig, nitro)
|
|
|
218
218
|
sourcesInput = ctx.sources;
|
|
219
219
|
}
|
|
220
220
|
const sources = await resolveSitemapSources(sourcesInput, resolvers.event);
|
|
221
|
+
const failedSources = sources.filter((source) => source.error && source._isFailure).map((source) => ({
|
|
222
|
+
url: typeof source.fetch === "string" ? source.fetch : source.fetch?.[0] || "unknown",
|
|
223
|
+
error: source.error || "Unknown error"
|
|
224
|
+
}));
|
|
221
225
|
const resolvedCtx = {
|
|
222
226
|
urls: sources.flatMap((s) => s.urls),
|
|
223
227
|
sitemapName: sitemap.sitemapName,
|
|
@@ -231,6 +235,7 @@ export async function buildSitemapUrls(sitemap, resolvers, runtimeConfig, nitro)
|
|
|
231
235
|
return true;
|
|
232
236
|
});
|
|
233
237
|
const sortedUrls = maybeSort(filteredUrls);
|
|
234
|
-
|
|
238
|
+
const urls = maybeSlice(sortedUrls);
|
|
239
|
+
return { urls, failedSources };
|
|
235
240
|
}
|
|
236
241
|
export { urlsToXml } from "./xml.js";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { ModuleRuntimeConfig, NitroUrlResolvers, ResolvedSitemapUrl } from '../../../types.js';
|
|
2
2
|
export declare function escapeValueForXml(value: boolean | string | number): string;
|
|
3
|
-
export declare function urlsToXml(urls: ResolvedSitemapUrl[], resolvers: NitroUrlResolvers, { version, xsl, credits, minify }: Pick<ModuleRuntimeConfig, 'version' | 'xsl' | 'credits' | 'minify'
|
|
3
|
+
export declare function urlsToXml(urls: ResolvedSitemapUrl[], resolvers: NitroUrlResolvers, { version, xsl, credits, minify }: Pick<ModuleRuntimeConfig, 'version' | 'xsl' | 'credits' | 'minify'>, errorInfo?: {
|
|
4
|
+
messages: string[];
|
|
5
|
+
urls: string[];
|
|
6
|
+
}): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { withQuery } from "ufo";
|
|
2
|
+
import { xmlEscape } from "../../utils.js";
|
|
1
3
|
export function escapeValueForXml(value) {
|
|
2
4
|
if (value === true || value === false)
|
|
3
5
|
return value ? "yes" : "no";
|
|
4
|
-
return String(value)
|
|
6
|
+
return xmlEscape(String(value));
|
|
5
7
|
}
|
|
6
8
|
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">';
|
|
7
9
|
function buildUrlXml(url) {
|
|
@@ -162,13 +164,20 @@ function buildUrlXml(url) {
|
|
|
162
164
|
parts[partIndex++] = " </url>";
|
|
163
165
|
return parts.slice(0, partIndex).join("\n");
|
|
164
166
|
}
|
|
165
|
-
export function urlsToXml(urls, resolvers, { version, xsl, credits, minify }) {
|
|
167
|
+
export function urlsToXml(urls, resolvers, { version, xsl, credits, minify }, errorInfo) {
|
|
166
168
|
const estimatedSize = urls.length + 5;
|
|
167
169
|
const xmlParts = Array.from({ length: estimatedSize });
|
|
168
170
|
let partIndex = 0;
|
|
169
|
-
|
|
171
|
+
let xslHref = xsl ? resolvers.relativeBaseUrlResolver(xsl) : false;
|
|
172
|
+
if (xslHref && errorInfo && errorInfo.messages.length > 0) {
|
|
173
|
+
xslHref = withQuery(xslHref, {
|
|
174
|
+
errors: "true",
|
|
175
|
+
error_messages: errorInfo.messages,
|
|
176
|
+
error_urls: errorInfo.urls
|
|
177
|
+
});
|
|
178
|
+
}
|
|
170
179
|
if (xslHref) {
|
|
171
|
-
xmlParts[partIndex++] = `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="${xslHref}"?>`;
|
|
180
|
+
xmlParts[partIndex++] = `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="${escapeValueForXml(xslHref)}"?>`;
|
|
172
181
|
} else {
|
|
173
182
|
xmlParts[partIndex++] = '<?xml version="1.0" encoding="UTF-8"?>';
|
|
174
183
|
}
|