@nuxtjs/sitemap 7.3.1 → 7.4.1
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/096c9e6a-a9a8-483d-bd1d-fed5634b0d08.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.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +32 -138
- 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 +65 -19
- package/dist/runtime/server/utils.d.ts +1 -0
- package/dist/runtime/server/utils.js +3 -0
- package/dist/runtime/types.d.ts +2 -0
- package/dist/shared/sitemap.DR3_6qqU.mjs +212 -0
- package/dist/utils.d.mts +28 -0
- package/dist/utils.d.ts +28 -0
- package/dist/utils.mjs +368 -0
- package/package.json +24 -15
- 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
- package/dist/content.cjs +0 -48
- package/dist/content.d.cts +0 -232
- package/dist/module.cjs +0 -1324
- package/dist/module.d.cts +0 -10
- package/dist/runtime/server/sitemap/utils/extractSitemapXML.d.ts +0 -2
- package/dist/runtime/server/sitemap/utils/extractSitemapXML.js +0 -75
|
@@ -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":"096c9e6a-a9a8-483d-bd1d-fed5634b0d08","timestamp":1750240314599}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"096c9e6a-a9a8-483d-bd1d-fed5634b0d08","timestamp":1750240314599,"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},1750240316764,false]</script>
|
|
13
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildId:"096c9e6a-a9a8-483d-bd1d-fed5634b0d08",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useNuxt, loadNuxtModuleInstance, createResolver, addTemplate, extendPages, tryUseNuxt, defineNuxtModule, useLogger, hasNuxtModule, getNuxtModuleVersion, hasNuxtModuleCompatibility, addServerImports, addServerPlugin, resolveModule, addServerHandler, addPrerenderRoutes } from '@nuxt/kit';
|
|
2
|
-
import { withHttps, withBase,
|
|
2
|
+
import { withHttps, withBase, joinURL, withTrailingSlash, withoutLeadingSlash, withLeadingSlash, withoutTrailingSlash } from 'ufo';
|
|
3
3
|
import { withSiteUrl, installNuxtSiteConfig } from 'nuxt-site-config/kit';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import { readPackageJSON } from 'pkg-types';
|
|
@@ -10,16 +10,24 @@ import { provider, env } from 'std-env';
|
|
|
10
10
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
11
11
|
import { join } from 'node:path';
|
|
12
12
|
import chalk from 'chalk';
|
|
13
|
+
import { p as parseHtmlExtractSitemapMeta } from './shared/sitemap.DR3_6qqU.mjs';
|
|
13
14
|
import { normaliseDate } from '../dist/runtime/server/sitemap/urlset/normalise.js';
|
|
15
|
+
import 'ultrahtml';
|
|
14
16
|
|
|
15
17
|
async function resolveUrls(urls, ctx) {
|
|
16
|
-
|
|
17
|
-
urls
|
|
18
|
-
|
|
18
|
+
try {
|
|
19
|
+
if (typeof urls === "function")
|
|
20
|
+
urls = urls();
|
|
21
|
+
urls = await urls;
|
|
22
|
+
} catch (e) {
|
|
23
|
+
ctx.logger.error(`Failed to resolve ${typeof urls} urls.`);
|
|
24
|
+
ctx.logger.error(e);
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
19
27
|
try {
|
|
20
28
|
urls = JSON.parse(JSON.stringify(urls));
|
|
21
29
|
} catch (e) {
|
|
22
|
-
ctx.logger.
|
|
30
|
+
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
31
|
ctx.logger.error(e);
|
|
24
32
|
return [];
|
|
25
33
|
}
|
|
@@ -266,124 +274,6 @@ function resolveNitroPreset(nitroConfig) {
|
|
|
266
274
|
return preset.replace("_", "-");
|
|
267
275
|
}
|
|
268
276
|
|
|
269
|
-
const videoRegex = /<video[^>]*>([\s\S]*?)<\/video>/g;
|
|
270
|
-
const videoSrcRegex = /<video[^>]*\ssrc="([^"]+)"/;
|
|
271
|
-
const videoPosterRegex = /<video[^>]*\sposter="([^"]+)"/;
|
|
272
|
-
const videoTitleRegex = /<video[^>]*\sdata-title="([^"]+)"/;
|
|
273
|
-
const videoDescriptionRegex = /<video[^>]*\sdata-description="([^"]+)"/;
|
|
274
|
-
const videoPlayerLocRegex = /<video[^>]*\sdata-player-loc="([^"]+)"/;
|
|
275
|
-
const videoDurationRegex = /<video[^>]*\sdata-duration="([^"]+)"/;
|
|
276
|
-
const videoExpirationDateRegex = /<video[^>]*\sdata-expiration-date="([^"]+)"/;
|
|
277
|
-
const videoRatingRegex = /<video[^>]*\sdata-rating="([^"]+)"/;
|
|
278
|
-
const videoViewCountRegex = /<video[^>]*\sdata-view-count="([^"]+)"/;
|
|
279
|
-
const videoPublicationDateRegex = /<video[^>]*\sdata-publication-date="([^"]+)"/;
|
|
280
|
-
const videoFamilyFriendlyRegex = /<video[^>]*\sdata-family-friendly="([^"]+)"/;
|
|
281
|
-
const videoRequiresSubscriptionRegex = /<video[^>]*\sdata-requires-subscription="([^"]+)"/;
|
|
282
|
-
const videoLiveRegex = /<video[^>]*\sdata-live="([^"]+)"/;
|
|
283
|
-
const videoTagRegex = /<video[^>]*\sdata-tag="([^"]+)"/;
|
|
284
|
-
const sourceRegex = /<source[^>]*\ssrc="([^"]+)"/g;
|
|
285
|
-
function extractSitemapMetaFromHtml(html, options) {
|
|
286
|
-
options = options || { images: true, videos: true, lastmod: true, alternatives: true };
|
|
287
|
-
const payload = {};
|
|
288
|
-
const resolveUrl = options?.resolveUrl || ((s) => s);
|
|
289
|
-
const mainRegex = /<main[^>]*>([\s\S]*?)<\/main>/;
|
|
290
|
-
const mainMatch = mainRegex.exec(html);
|
|
291
|
-
if (options?.images) {
|
|
292
|
-
const images = /* @__PURE__ */ new Set();
|
|
293
|
-
if (mainMatch?.[1] && mainMatch[1].includes("<img")) {
|
|
294
|
-
const imgRegex = /<img\s+(?:[^>]*?\s)?src=["']((?!data:|blob:|file:)[^"']+?)["'][^>]*>/gi;
|
|
295
|
-
let match;
|
|
296
|
-
while ((match = imgRegex.exec(mainMatch[1])) !== null) {
|
|
297
|
-
if (match.index === imgRegex.lastIndex)
|
|
298
|
-
imgRegex.lastIndex++;
|
|
299
|
-
const url = resolveUrl(match[1]);
|
|
300
|
-
images.add(url);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
if (images.size > 0)
|
|
304
|
-
payload.images = [...images].map((i) => ({ loc: i }));
|
|
305
|
-
}
|
|
306
|
-
if (options?.videos) {
|
|
307
|
-
const videos = [];
|
|
308
|
-
if (mainMatch?.[1] && mainMatch[1].includes("<video")) {
|
|
309
|
-
let videoMatch;
|
|
310
|
-
while ((videoMatch = videoRegex.exec(mainMatch[1])) !== null) {
|
|
311
|
-
const videoContent = videoMatch[1];
|
|
312
|
-
const videoTag = videoMatch[0];
|
|
313
|
-
const content_loc = (videoSrcRegex.exec(videoTag) || [])[1] || "";
|
|
314
|
-
const thumbnail_loc = (videoPosterRegex.exec(videoTag) || [])[1] || "";
|
|
315
|
-
const title = (videoTitleRegex.exec(videoTag) || [])[1] || "";
|
|
316
|
-
const description = (videoDescriptionRegex.exec(videoTag) || [])[1] || "";
|
|
317
|
-
const videoObj = {
|
|
318
|
-
content_loc,
|
|
319
|
-
thumbnail_loc,
|
|
320
|
-
title,
|
|
321
|
-
description
|
|
322
|
-
};
|
|
323
|
-
const player_loc = (videoPlayerLocRegex.exec(videoTag) || [])[1];
|
|
324
|
-
if (player_loc) videoObj.player_loc = player_loc;
|
|
325
|
-
const duration = (videoDurationRegex.exec(videoTag) || [])[1];
|
|
326
|
-
if (duration) videoObj.duration = Number.parseInt(duration, 10);
|
|
327
|
-
const expiration_date = (videoExpirationDateRegex.exec(videoTag) || [])[1];
|
|
328
|
-
if (expiration_date) videoObj.expiration_date = expiration_date;
|
|
329
|
-
const rating = (videoRatingRegex.exec(videoTag) || [])[1];
|
|
330
|
-
if (rating) videoObj.rating = Number.parseFloat(rating);
|
|
331
|
-
const view_count = (videoViewCountRegex.exec(videoTag) || [])[1];
|
|
332
|
-
if (view_count) videoObj.view_count = Number.parseInt(view_count, 10);
|
|
333
|
-
const publication_date = (videoPublicationDateRegex.exec(videoTag) || [])[1];
|
|
334
|
-
if (publication_date) videoObj.publication_date = publication_date;
|
|
335
|
-
const family_friendly = (videoFamilyFriendlyRegex.exec(videoTag) || [])[1];
|
|
336
|
-
if (family_friendly) videoObj.family_friendly = family_friendly;
|
|
337
|
-
const requires_subscription = (videoRequiresSubscriptionRegex.exec(videoTag) || [])[1];
|
|
338
|
-
if (requires_subscription) videoObj.requires_subscription = requires_subscription;
|
|
339
|
-
const live = (videoLiveRegex.exec(videoTag) || [])[1];
|
|
340
|
-
if (live) videoObj.live = live;
|
|
341
|
-
const tag = (videoTagRegex.exec(videoTag) || [])[1];
|
|
342
|
-
if (tag) videoObj.tag = tag;
|
|
343
|
-
const sources = [];
|
|
344
|
-
let sourceMatch;
|
|
345
|
-
while ((sourceMatch = sourceRegex.exec(videoContent)) !== null) {
|
|
346
|
-
sources.push(sourceMatch[1]);
|
|
347
|
-
}
|
|
348
|
-
if (sources.length > 0) {
|
|
349
|
-
videos.push(...sources.map((source) => {
|
|
350
|
-
if (videoObj.thumbnail_loc) {
|
|
351
|
-
videoObj.thumbnail_loc = resolveUrl(String(videoObj.thumbnail_loc));
|
|
352
|
-
}
|
|
353
|
-
return {
|
|
354
|
-
...videoObj,
|
|
355
|
-
content_loc: resolveUrl(source)
|
|
356
|
-
};
|
|
357
|
-
}));
|
|
358
|
-
} else {
|
|
359
|
-
videos.push(videoObj);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
const validVideos = videos.filter((v) => {
|
|
364
|
-
return v.content_loc && v.thumbnail_loc && v.title && v.description;
|
|
365
|
-
});
|
|
366
|
-
if (validVideos.length > 0) {
|
|
367
|
-
payload.videos = validVideos;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
if (options?.lastmod) {
|
|
371
|
-
const articleModifiedTime = html.match(/<meta[^>]+property="article:modified_time"[^>]+content="([^"]+)"/)?.[1] || html.match(/<meta[^>]+content="([^"]+)"[^>]+property="article:modified_time"/)?.[1];
|
|
372
|
-
if (articleModifiedTime)
|
|
373
|
-
payload.lastmod = articleModifiedTime;
|
|
374
|
-
}
|
|
375
|
-
if (options?.alternatives) {
|
|
376
|
-
const alternatives = (html.match(/<link[^>]+rel="alternate"[^>]+>/g) || []).map((a) => {
|
|
377
|
-
const href = a.match(/href="([^"]+)"/)?.[1];
|
|
378
|
-
const hreflang = a.match(/hreflang="([^"]+)"/)?.[1];
|
|
379
|
-
return { hreflang, href: parseURL(href).pathname };
|
|
380
|
-
}).filter((a) => a.hreflang && a.href);
|
|
381
|
-
if (alternatives?.length && (alternatives.length > 1 || alternatives?.[0].hreflang !== "x-default"))
|
|
382
|
-
payload.alternatives = alternatives;
|
|
383
|
-
}
|
|
384
|
-
return payload;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
277
|
function formatPrerenderRoute(route) {
|
|
388
278
|
let str = ` \u251C\u2500 ${route.route} (${route.generateTimeMS}ms)`;
|
|
389
279
|
if (route.error) {
|
|
@@ -398,7 +288,7 @@ function includesSitemapRoot(sitemapName, routes) {
|
|
|
398
288
|
return routes.includes(`/__sitemap__/`) || routes.includes(`/sitemap.xml`) || routes.includes(`/${sitemapName}`) || routes.includes("/sitemap_index.xml");
|
|
399
289
|
}
|
|
400
290
|
function isNuxtGenerate(nuxt = useNuxt()) {
|
|
401
|
-
return nuxt.options._generate || [
|
|
291
|
+
return nuxt.options.nitro.static || nuxt.options._generate || [
|
|
402
292
|
"static",
|
|
403
293
|
"github-pages"
|
|
404
294
|
].includes(resolveNitroPreset());
|
|
@@ -412,8 +302,17 @@ function setupPrerenderHandler(_options, nuxt = useNuxt()) {
|
|
|
412
302
|
logger.warn("Runtime sitemaps are not supported on Vercel Edge, falling back to prerendering sitemaps.");
|
|
413
303
|
prerenderSitemap = true;
|
|
414
304
|
}
|
|
415
|
-
|
|
416
|
-
|
|
305
|
+
nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
|
|
306
|
+
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
|
|
307
|
+
const shouldHookIntoPrerender = prerenderSitemap || nuxt.options.nitro.prerender.routes.length && nuxt.options.nitro.prerender.crawlLinks;
|
|
308
|
+
if (isNuxtGenerate() && options.debug) {
|
|
309
|
+
nuxt.options.nitro.prerender.routes.push("/__sitemap__/debug.json");
|
|
310
|
+
logger.info("Adding debug route for sitemap generation:", chalk.cyan("/__sitemap__/debug.json"));
|
|
311
|
+
}
|
|
312
|
+
if (!shouldHookIntoPrerender) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes.filter((r) => r && !includesSitemapRoot(options.sitemapName, [r]));
|
|
417
316
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
418
317
|
let prerenderer;
|
|
419
318
|
nitro.hooks.hook("prerender:init", async (_prerenderer) => {
|
|
@@ -438,7 +337,7 @@ function setupPrerenderHandler(_options, nuxt = useNuxt()) {
|
|
|
438
337
|
route._sitemap._sitemap = _sitemap;
|
|
439
338
|
}
|
|
440
339
|
}
|
|
441
|
-
route._sitemap = defu(
|
|
340
|
+
route._sitemap = defu(parseHtmlExtractSitemapMeta(html, {
|
|
442
341
|
images: options.discoverImages,
|
|
443
342
|
videos: options.discoverVideos,
|
|
444
343
|
// TODO configurable?
|
|
@@ -461,16 +360,7 @@ function setupPrerenderHandler(_options, nuxt = useNuxt()) {
|
|
|
461
360
|
return;
|
|
462
361
|
}
|
|
463
362
|
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);
|
|
363
|
+
await prerenderRoute(nitro, options.isMultiSitemap ? "/sitemap_index.xml" : `/${Object.keys(options.sitemaps)[0]}`);
|
|
474
364
|
});
|
|
475
365
|
});
|
|
476
366
|
}
|
|
@@ -894,7 +784,11 @@ declare module 'vue-router' {
|
|
|
894
784
|
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
785
|
}
|
|
896
786
|
config.exclude.push("/__nuxt_content/**");
|
|
897
|
-
|
|
787
|
+
const needsCustomAlias = await hasNuxtModuleCompatibility("@nuxt/content", "<3.6.0");
|
|
788
|
+
if (needsCustomAlias) {
|
|
789
|
+
nuxt.options.alias["#sitemap/content-v3-nitro-path"] = resolve(dirname(resolveModule("@nuxt/content")), "runtime/nitro");
|
|
790
|
+
nuxt.options.alias["@nuxt/content/nitro"] = resolve("./runtime/server/content-compat");
|
|
791
|
+
}
|
|
898
792
|
nuxt.hooks.hook("content:file:afterParse", (ctx) => {
|
|
899
793
|
const content = ctx.content;
|
|
900
794
|
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";
|