@nuxtjs/sitemap 7.2.10 → 7.3.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 +9 -9
- package/dist/client/404.html +9 -9
- package/dist/client/_nuxt/Cp-IABpG.js +1 -0
- package/dist/client/_nuxt/{DDzCRRw4.js → DJVkgDQ2.js} +1 -1
- package/dist/client/_nuxt/SmY-NWqO.js +172 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/e48bfd5b-6605-4bbc-a466-32a664787616.json +1 -0
- package/dist/client/_nuxt/error-404.CtcyoHAN.css +1 -0
- package/dist/client/_nuxt/error-500.BIlfyoPk.css +1 -0
- package/dist/client/_nuxt/{DdvkoY3I.js → lL_X76lO.js} +1 -1
- package/dist/client/index.html +9 -9
- package/dist/module.cjs +57 -18
- package/dist/module.json +2 -2
- package/dist/module.mjs +58 -19
- package/dist/runtime/server/plugins/warm-up.js +20 -4
- package/dist/runtime/server/routes/__sitemap__/debug.js +2 -2
- package/dist/runtime/server/routes/sitemap/[sitemap].xml.js +37 -7
- package/dist/runtime/server/routes/sitemap_index.xml.js +11 -3
- package/dist/runtime/server/sitemap/builder/sitemap-index.d.ts +1 -1
- package/dist/runtime/server/sitemap/builder/sitemap-index.js +110 -16
- package/dist/runtime/server/sitemap/builder/sitemap.d.ts +1 -1
- package/dist/runtime/server/sitemap/builder/sitemap.js +62 -36
- package/dist/runtime/server/sitemap/builder/xml.d.ts +2 -3
- package/dist/runtime/server/sitemap/builder/xml.js +182 -80
- package/dist/runtime/server/sitemap/nitro.js +68 -20
- package/dist/runtime/server/sitemap/urlset/normalise.js +21 -19
- package/dist/runtime/server/sitemap/urlset/sort.d.ts +1 -1
- package/dist/runtime/server/sitemap/urlset/sort.js +9 -15
- package/dist/runtime/server/sitemap/utils/chunk.d.ts +10 -0
- package/dist/runtime/server/sitemap/utils/chunk.js +66 -0
- package/dist/runtime/types.d.ts +44 -0
- package/dist/runtime/utils-pure.js +13 -5
- package/package.json +23 -22
- package/dist/client/_nuxt/BLmTiKMJ.js +0 -1
- package/dist/client/_nuxt/BUP090M8.js +0 -172
- package/dist/client/_nuxt/builds/meta/3c351607-eab3-459a-b743-aba04e49a80e.json +0 -1
- package/dist/client/_nuxt/error-404.BMkETmdU.css +0 -1
- package/dist/client/_nuxt/error-500.C3_I-O7u.css +0 -1
- /package/dist/client/_nuxt/{entry.BrROiVtQ.css → entry.CgW0_noo.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"e48bfd5b-6605-4bbc-a466-32a664787616","timestamp":1747714836310}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"e48bfd5b-6605-4bbc-a466-32a664787616","timestamp":1747714836310,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spotlight[data-v-938bc6b1]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-938bc6b1]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-938bc6b1]{background-color:#ffffff4d}.gradient-border[data-v-938bc6b1]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-938bc6b1]{background-color:#1414144d}.gradient-border[data-v-938bc6b1]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-938bc6b1]: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-938bc6b1]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-938bc6b1]{position:fixed}.left-0[data-v-938bc6b1]{left:0}.right-0[data-v-938bc6b1]{right:0}.z-10[data-v-938bc6b1]{z-index:10}.z-20[data-v-938bc6b1]{z-index:20}.grid[data-v-938bc6b1]{display:grid}.mb-16[data-v-938bc6b1]{margin-bottom:4rem}.mb-8[data-v-938bc6b1]{margin-bottom:2rem}.max-w-520px[data-v-938bc6b1]{max-width:520px}.min-h-screen[data-v-938bc6b1]{min-height:100vh}.w-full[data-v-938bc6b1]{width:100%}.flex[data-v-938bc6b1]{display:flex}.cursor-pointer[data-v-938bc6b1]{cursor:pointer}.place-content-center[data-v-938bc6b1]{place-content:center}.items-center[data-v-938bc6b1]{align-items:center}.justify-center[data-v-938bc6b1]{justify-content:center}.overflow-hidden[data-v-938bc6b1]{overflow:hidden}.bg-white[data-v-938bc6b1]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-938bc6b1]{padding-left:1rem;padding-right:1rem}.px-8[data-v-938bc6b1]{padding-left:2rem;padding-right:2rem}.py-2[data-v-938bc6b1]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-938bc6b1]{text-align:center}.text-8xl[data-v-938bc6b1]{font-size:6rem;line-height:1}.text-xl[data-v-938bc6b1]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-938bc6b1]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-938bc6b1]{font-weight:300}.font-medium[data-v-938bc6b1]{font-weight:500}.leading-tight[data-v-938bc6b1]{line-height:1.25}.font-sans[data-v-938bc6b1]{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-938bc6b1]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-938bc6b1]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-938bc6b1]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-938bc6b1]{padding-left:0;padding-right:0}.sm\:px-6[data-v-938bc6b1]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-938bc6b1]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-938bc6b1]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-938bc6b1]{font-size:1.25rem;line-height:1.75rem}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spotlight[data-v-ee7494af]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-ee7494af]{position:fixed}.-bottom-1\/2[data-v-ee7494af]{bottom:-50%}.left-0[data-v-ee7494af]{left:0}.right-0[data-v-ee7494af]{right:0}.grid[data-v-ee7494af]{display:grid}.mb-16[data-v-ee7494af]{margin-bottom:4rem}.mb-8[data-v-ee7494af]{margin-bottom:2rem}.h-1\/2[data-v-ee7494af]{height:50%}.max-w-520px[data-v-ee7494af]{max-width:520px}.min-h-screen[data-v-ee7494af]{min-height:100vh}.place-content-center[data-v-ee7494af]{place-content:center}.overflow-hidden[data-v-ee7494af]{overflow:hidden}.bg-white[data-v-ee7494af]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-ee7494af]{padding-left:2rem;padding-right:2rem}.text-center[data-v-ee7494af]{text-align:center}.text-8xl[data-v-ee7494af]{font-size:6rem;line-height:1}.text-xl[data-v-ee7494af]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-ee7494af]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-ee7494af]{font-weight:300}.font-medium[data-v-ee7494af]{font-weight:500}.leading-tight[data-v-ee7494af]{line-height:1.25}.font-sans[data-v-ee7494af]{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-ee7494af]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-ee7494af]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-ee7494af]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-ee7494af]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-ee7494af]{font-size:2.25rem;line-height:2.5rem}}
|
|
@@ -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"./SmY-NWqO.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)])]))}},h=s(f,[["__scopeId","data-v-ee7494af"]]);export{h as default};
|
package/dist/client/index.html
CHANGED
|
@@ -1,13 +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
|
-
<link rel="stylesheet" href="/__sitemap__/devtools/_nuxt/entry.
|
|
4
|
-
<link rel="modulepreload" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/
|
|
3
|
+
<link rel="stylesheet" href="/__sitemap__/devtools/_nuxt/entry.CgW0_noo.css" crossorigin>
|
|
4
|
+
<link rel="modulepreload" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/SmY-NWqO.js">
|
|
5
5
|
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/CVO1_9PV.js">
|
|
6
6
|
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/D0r3Knsf.js">
|
|
7
|
-
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/
|
|
8
|
-
<link rel="prefetch" as="style" crossorigin href="/__sitemap__/devtools/_nuxt/error-404.
|
|
9
|
-
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/
|
|
10
|
-
<link rel="prefetch" as="style" crossorigin href="/__sitemap__/devtools/_nuxt/error-500.
|
|
11
|
-
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/
|
|
12
|
-
<script type="module" src="/__sitemap__/devtools/_nuxt/
|
|
13
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildId:"
|
|
7
|
+
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/Cp-IABpG.js">
|
|
8
|
+
<link rel="prefetch" as="style" crossorigin href="/__sitemap__/devtools/_nuxt/error-404.CtcyoHAN.css">
|
|
9
|
+
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/DJVkgDQ2.js">
|
|
10
|
+
<link rel="prefetch" as="style" crossorigin href="/__sitemap__/devtools/_nuxt/error-500.BIlfyoPk.css">
|
|
11
|
+
<link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/lL_X76lO.js">
|
|
12
|
+
<script type="module" src="/__sitemap__/devtools/_nuxt/SmY-NWqO.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},1747714838720,false]</script>
|
|
13
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildId:"e48bfd5b-6605-4bbc-a466-32a664787616",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.cjs
CHANGED
|
@@ -747,11 +747,11 @@ const module$1 = kit.defineNuxtModule({
|
|
|
747
747
|
const locale = normalisedLocales.find((l) => l.code === localeCode);
|
|
748
748
|
if (!locale || !pageLocales[localeCode] || pageLocales[localeCode].includes("["))
|
|
749
749
|
continue;
|
|
750
|
-
const alternatives = Object.keys(pageLocales).map((l) => ({
|
|
750
|
+
const alternatives = Object.keys(pageLocales).filter((l) => pageLocales[l] !== false).map((l) => ({
|
|
751
751
|
hreflang: normalisedLocales.find((nl) => nl.code === l)?._hreflang || l,
|
|
752
752
|
href: generatePathForI18nPages({ localeCode: l, pageLocales: pageLocales[l], nuxtI18nConfig, normalisedLocales })
|
|
753
753
|
}));
|
|
754
|
-
if (alternatives.length && nuxtI18nConfig.defaultLocale && pageLocales[nuxtI18nConfig.defaultLocale])
|
|
754
|
+
if (alternatives.length && nuxtI18nConfig.defaultLocale && pageLocales[nuxtI18nConfig.defaultLocale] && pageLocales[nuxtI18nConfig.defaultLocale] !== false)
|
|
755
755
|
alternatives.push({ hreflang: "x-default", href: generatePathForI18nPages({ normalisedLocales, localeCode: nuxtI18nConfig.defaultLocale, pageLocales: pageLocales[nuxtI18nConfig.defaultLocale], nuxtI18nConfig }) });
|
|
756
756
|
i18nPagesSources.urls.push({
|
|
757
757
|
_sitemap: locale._sitemap,
|
|
@@ -781,7 +781,9 @@ const module$1 = kit.defineNuxtModule({
|
|
|
781
781
|
differentDomains: nuxtI18nConfig.differentDomains,
|
|
782
782
|
defaultLocale: nuxtI18nConfig.defaultLocale,
|
|
783
783
|
locales: normalisedLocales,
|
|
784
|
-
strategy: nuxtI18nConfig.strategy
|
|
784
|
+
strategy: nuxtI18nConfig.strategy,
|
|
785
|
+
// @ts-expect-error untyped
|
|
786
|
+
pages: nuxtI18nConfig.pages
|
|
785
787
|
};
|
|
786
788
|
}
|
|
787
789
|
let canI18nMap = config.sitemaps !== false && nuxtI18nConfig.strategy !== "no_prefix";
|
|
@@ -838,6 +840,7 @@ declare module 'nitropack' {
|
|
|
838
840
|
'sitemap:input': (ctx: import('${typesPath}').SitemapInputCtx) => void | Promise<void>
|
|
839
841
|
'sitemap:resolved': (ctx: import('${typesPath}').SitemapRenderCtx) => void | Promise<void>
|
|
840
842
|
'sitemap:output': (ctx: import('${typesPath}').SitemapOutputHookCtx) => void | Promise<void>
|
|
843
|
+
'sitemap:sources': (ctx: import('${typesPath}').SitemapSourcesHookCtx) => void | Promise<void>
|
|
841
844
|
}
|
|
842
845
|
}
|
|
843
846
|
declare module 'vue-router' {
|
|
@@ -847,7 +850,6 @@ declare module 'vue-router' {
|
|
|
847
850
|
}
|
|
848
851
|
`;
|
|
849
852
|
});
|
|
850
|
-
const nitroPreset = resolveNitroPreset();
|
|
851
853
|
const prerenderedRoutes = nuxt.options.nitro.prerender?.routes || [];
|
|
852
854
|
const prerenderSitemap = isNuxtGenerate() || includesSitemapRoot(config.sitemapName, prerenderedRoutes);
|
|
853
855
|
const routeRules = {};
|
|
@@ -859,17 +861,6 @@ declare module 'vue-router' {
|
|
|
859
861
|
"X-Sitemap-Prerendered": (/* @__PURE__ */ new Date()).toISOString()
|
|
860
862
|
};
|
|
861
863
|
}
|
|
862
|
-
if (!nuxt.options.dev && !isNuxtGenerate() && config.cacheMaxAgeSeconds && config.runtimeCacheStorage !== false) {
|
|
863
|
-
routeRules[nitroPreset.includes("vercel") ? "isr" : "swr"] = config.cacheMaxAgeSeconds;
|
|
864
|
-
routeRules.cache = {
|
|
865
|
-
// handle multi-tenancy
|
|
866
|
-
swr: true,
|
|
867
|
-
maxAge: config.cacheMaxAgeSeconds,
|
|
868
|
-
varies: ["X-Forwarded-Host", "X-Forwarded-Proto", "Host"]
|
|
869
|
-
};
|
|
870
|
-
if (typeof config.runtimeCacheStorage === "object")
|
|
871
|
-
routeRules.cache.base = "sitemap";
|
|
872
|
-
}
|
|
873
864
|
if (config.xsl) {
|
|
874
865
|
nuxt.options.nitro.routeRules[config.xsl] = {
|
|
875
866
|
headers: {
|
|
@@ -882,10 +873,16 @@ declare module 'vue-router' {
|
|
|
882
873
|
nuxt.options.nitro.routeRules["/sitemap_index.xml"] = routeRules;
|
|
883
874
|
if (typeof config.sitemaps === "object") {
|
|
884
875
|
for (const k in config.sitemaps) {
|
|
876
|
+
if (k === "index")
|
|
877
|
+
continue;
|
|
885
878
|
nuxt.options.nitro.routeRules[ufo.joinURL(config.sitemapsPathPrefix || "", `/${k}.xml`)] = routeRules;
|
|
879
|
+
const sitemapConfig = config.sitemaps[k];
|
|
880
|
+
if (sitemapConfig.chunks) {
|
|
881
|
+
nuxt.options.nitro.routeRules[ufo.joinURL(config.sitemapsPathPrefix || "", `/${k}-*.xml`)] = routeRules;
|
|
882
|
+
}
|
|
886
883
|
}
|
|
887
884
|
} else {
|
|
888
|
-
nuxt.options.nitro.routeRules[
|
|
885
|
+
nuxt.options.nitro.routeRules[ufo.joinURL(config.sitemapsPathPrefix || "", `/[0-9]+.xml`)] = routeRules;
|
|
889
886
|
}
|
|
890
887
|
} else {
|
|
891
888
|
nuxt.options.nitro.routeRules[`/${config.sitemapName}`] = routeRules;
|
|
@@ -995,13 +992,25 @@ declare module 'vue-router' {
|
|
|
995
992
|
middleware: false
|
|
996
993
|
});
|
|
997
994
|
} else {
|
|
998
|
-
|
|
995
|
+
const sitemapNames = Object.keys(config.sitemaps || {});
|
|
996
|
+
for (const sitemapName of sitemapNames) {
|
|
997
|
+
if (sitemapName === "index")
|
|
998
|
+
continue;
|
|
999
|
+
const sitemapConfig = config.sitemaps[sitemapName];
|
|
999
1000
|
kit.addServerHandler({
|
|
1000
1001
|
route: ufo.withLeadingSlash(`${sitemapName}.xml`),
|
|
1001
1002
|
handler: resolve("./runtime/server/routes/sitemap/[sitemap].xml"),
|
|
1002
1003
|
lazy: true,
|
|
1003
1004
|
middleware: false
|
|
1004
1005
|
});
|
|
1006
|
+
if (sitemapConfig.chunks) {
|
|
1007
|
+
kit.addServerHandler({
|
|
1008
|
+
route: `/${sitemapName}-*.xml`,
|
|
1009
|
+
handler: resolve("./runtime/server/routes/sitemap/[sitemap].xml"),
|
|
1010
|
+
lazy: true,
|
|
1011
|
+
middleware: false
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1005
1014
|
}
|
|
1006
1015
|
}
|
|
1007
1016
|
sitemaps.index = {
|
|
@@ -1015,7 +1024,7 @@ declare module 'vue-router' {
|
|
|
1015
1024
|
if (sitemapName === "index")
|
|
1016
1025
|
continue;
|
|
1017
1026
|
const definition = config.sitemaps[sitemapName];
|
|
1018
|
-
|
|
1027
|
+
const sitemapConfig = defu.defu(
|
|
1019
1028
|
{
|
|
1020
1029
|
sitemapName,
|
|
1021
1030
|
_route: ufo.withBase(ufo.joinURL(config.sitemapsPathPrefix || "", `${sitemapName}.xml`), nuxt.options.app.baseURL || "/"),
|
|
@@ -1024,6 +1033,28 @@ declare module 'vue-router' {
|
|
|
1024
1033
|
{ ...definition, urls: void 0, sources: void 0 },
|
|
1025
1034
|
{ include: config.include, exclude: config.exclude }
|
|
1026
1035
|
);
|
|
1036
|
+
if (definition.chunks) {
|
|
1037
|
+
let chunkSize = config.defaultSitemapsChunkSize || 1e3;
|
|
1038
|
+
if (typeof definition.chunks === "number") {
|
|
1039
|
+
if (definition.chunks <= 0) {
|
|
1040
|
+
logger.warn(`Invalid chunks value (${definition.chunks}) for sitemap "${sitemapName}". Using default.`);
|
|
1041
|
+
} else {
|
|
1042
|
+
chunkSize = definition.chunks;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
if (definition.chunkSize !== void 0) {
|
|
1046
|
+
if (typeof definition.chunkSize !== "number" || definition.chunkSize <= 0) {
|
|
1047
|
+
logger.warn(`Invalid chunkSize value (${definition.chunkSize}) for sitemap "${sitemapName}". Using default.`);
|
|
1048
|
+
} else {
|
|
1049
|
+
chunkSize = definition.chunkSize;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
sitemapConfig._isChunking = true;
|
|
1053
|
+
sitemapConfig._chunkSize = chunkSize;
|
|
1054
|
+
sitemapConfig.chunks = definition.chunks;
|
|
1055
|
+
sitemapConfig.chunkSize = definition.chunkSize;
|
|
1056
|
+
}
|
|
1057
|
+
sitemaps[sitemapName] = sitemapConfig;
|
|
1027
1058
|
}
|
|
1028
1059
|
} else {
|
|
1029
1060
|
sitemaps.chunks = {
|
|
@@ -1125,6 +1156,14 @@ declare module 'vue-router' {
|
|
|
1125
1156
|
route: "/__sitemap__/debug.json",
|
|
1126
1157
|
handler: resolve("./runtime/server/routes/__sitemap__/debug")
|
|
1127
1158
|
});
|
|
1159
|
+
if (usingMultiSitemaps) {
|
|
1160
|
+
kit.addServerHandler({
|
|
1161
|
+
route: "/__sitemap__/**:sitemap",
|
|
1162
|
+
handler: resolve("./runtime/server/routes/sitemap/[sitemap].xml"),
|
|
1163
|
+
lazy: true,
|
|
1164
|
+
middleware: true
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1128
1167
|
setupDevToolsUI(config, resolve);
|
|
1129
1168
|
}
|
|
1130
1169
|
const imports = [
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useNuxt, loadNuxtModuleInstance, createResolver, addTemplate,
|
|
1
|
+
import { useNuxt, loadNuxtModuleInstance, createResolver, addTemplate, extendPages, tryUseNuxt, defineNuxtModule, useLogger, hasNuxtModule, getNuxtModuleVersion, hasNuxtModuleCompatibility, addServerImports, addServerPlugin, resolveModule, addServerHandler, addPrerenderRoutes } from '@nuxt/kit';
|
|
2
2
|
import { withHttps, withBase, parseURL, joinURL, withTrailingSlash, withoutLeadingSlash, withLeadingSlash, withoutTrailingSlash } from 'ufo';
|
|
3
3
|
import { withSiteUrl, installNuxtSiteConfig } from 'nuxt-site-config/kit';
|
|
4
4
|
import { defu } from 'defu';
|
|
@@ -740,11 +740,11 @@ const module = defineNuxtModule({
|
|
|
740
740
|
const locale = normalisedLocales.find((l) => l.code === localeCode);
|
|
741
741
|
if (!locale || !pageLocales[localeCode] || pageLocales[localeCode].includes("["))
|
|
742
742
|
continue;
|
|
743
|
-
const alternatives = Object.keys(pageLocales).map((l) => ({
|
|
743
|
+
const alternatives = Object.keys(pageLocales).filter((l) => pageLocales[l] !== false).map((l) => ({
|
|
744
744
|
hreflang: normalisedLocales.find((nl) => nl.code === l)?._hreflang || l,
|
|
745
745
|
href: generatePathForI18nPages({ localeCode: l, pageLocales: pageLocales[l], nuxtI18nConfig, normalisedLocales })
|
|
746
746
|
}));
|
|
747
|
-
if (alternatives.length && nuxtI18nConfig.defaultLocale && pageLocales[nuxtI18nConfig.defaultLocale])
|
|
747
|
+
if (alternatives.length && nuxtI18nConfig.defaultLocale && pageLocales[nuxtI18nConfig.defaultLocale] && pageLocales[nuxtI18nConfig.defaultLocale] !== false)
|
|
748
748
|
alternatives.push({ hreflang: "x-default", href: generatePathForI18nPages({ normalisedLocales, localeCode: nuxtI18nConfig.defaultLocale, pageLocales: pageLocales[nuxtI18nConfig.defaultLocale], nuxtI18nConfig }) });
|
|
749
749
|
i18nPagesSources.urls.push({
|
|
750
750
|
_sitemap: locale._sitemap,
|
|
@@ -774,7 +774,9 @@ const module = defineNuxtModule({
|
|
|
774
774
|
differentDomains: nuxtI18nConfig.differentDomains,
|
|
775
775
|
defaultLocale: nuxtI18nConfig.defaultLocale,
|
|
776
776
|
locales: normalisedLocales,
|
|
777
|
-
strategy: nuxtI18nConfig.strategy
|
|
777
|
+
strategy: nuxtI18nConfig.strategy,
|
|
778
|
+
// @ts-expect-error untyped
|
|
779
|
+
pages: nuxtI18nConfig.pages
|
|
778
780
|
};
|
|
779
781
|
}
|
|
780
782
|
let canI18nMap = config.sitemaps !== false && nuxtI18nConfig.strategy !== "no_prefix";
|
|
@@ -831,6 +833,7 @@ declare module 'nitropack' {
|
|
|
831
833
|
'sitemap:input': (ctx: import('${typesPath}').SitemapInputCtx) => void | Promise<void>
|
|
832
834
|
'sitemap:resolved': (ctx: import('${typesPath}').SitemapRenderCtx) => void | Promise<void>
|
|
833
835
|
'sitemap:output': (ctx: import('${typesPath}').SitemapOutputHookCtx) => void | Promise<void>
|
|
836
|
+
'sitemap:sources': (ctx: import('${typesPath}').SitemapSourcesHookCtx) => void | Promise<void>
|
|
834
837
|
}
|
|
835
838
|
}
|
|
836
839
|
declare module 'vue-router' {
|
|
@@ -840,7 +843,6 @@ declare module 'vue-router' {
|
|
|
840
843
|
}
|
|
841
844
|
`;
|
|
842
845
|
});
|
|
843
|
-
const nitroPreset = resolveNitroPreset();
|
|
844
846
|
const prerenderedRoutes = nuxt.options.nitro.prerender?.routes || [];
|
|
845
847
|
const prerenderSitemap = isNuxtGenerate() || includesSitemapRoot(config.sitemapName, prerenderedRoutes);
|
|
846
848
|
const routeRules = {};
|
|
@@ -852,17 +854,6 @@ declare module 'vue-router' {
|
|
|
852
854
|
"X-Sitemap-Prerendered": (/* @__PURE__ */ new Date()).toISOString()
|
|
853
855
|
};
|
|
854
856
|
}
|
|
855
|
-
if (!nuxt.options.dev && !isNuxtGenerate() && config.cacheMaxAgeSeconds && config.runtimeCacheStorage !== false) {
|
|
856
|
-
routeRules[nitroPreset.includes("vercel") ? "isr" : "swr"] = config.cacheMaxAgeSeconds;
|
|
857
|
-
routeRules.cache = {
|
|
858
|
-
// handle multi-tenancy
|
|
859
|
-
swr: true,
|
|
860
|
-
maxAge: config.cacheMaxAgeSeconds,
|
|
861
|
-
varies: ["X-Forwarded-Host", "X-Forwarded-Proto", "Host"]
|
|
862
|
-
};
|
|
863
|
-
if (typeof config.runtimeCacheStorage === "object")
|
|
864
|
-
routeRules.cache.base = "sitemap";
|
|
865
|
-
}
|
|
866
857
|
if (config.xsl) {
|
|
867
858
|
nuxt.options.nitro.routeRules[config.xsl] = {
|
|
868
859
|
headers: {
|
|
@@ -875,10 +866,16 @@ declare module 'vue-router' {
|
|
|
875
866
|
nuxt.options.nitro.routeRules["/sitemap_index.xml"] = routeRules;
|
|
876
867
|
if (typeof config.sitemaps === "object") {
|
|
877
868
|
for (const k in config.sitemaps) {
|
|
869
|
+
if (k === "index")
|
|
870
|
+
continue;
|
|
878
871
|
nuxt.options.nitro.routeRules[joinURL(config.sitemapsPathPrefix || "", `/${k}.xml`)] = routeRules;
|
|
872
|
+
const sitemapConfig = config.sitemaps[k];
|
|
873
|
+
if (sitemapConfig.chunks) {
|
|
874
|
+
nuxt.options.nitro.routeRules[joinURL(config.sitemapsPathPrefix || "", `/${k}-*.xml`)] = routeRules;
|
|
875
|
+
}
|
|
879
876
|
}
|
|
880
877
|
} else {
|
|
881
|
-
nuxt.options.nitro.routeRules[
|
|
878
|
+
nuxt.options.nitro.routeRules[joinURL(config.sitemapsPathPrefix || "", `/[0-9]+.xml`)] = routeRules;
|
|
882
879
|
}
|
|
883
880
|
} else {
|
|
884
881
|
nuxt.options.nitro.routeRules[`/${config.sitemapName}`] = routeRules;
|
|
@@ -988,13 +985,25 @@ declare module 'vue-router' {
|
|
|
988
985
|
middleware: false
|
|
989
986
|
});
|
|
990
987
|
} else {
|
|
991
|
-
|
|
988
|
+
const sitemapNames = Object.keys(config.sitemaps || {});
|
|
989
|
+
for (const sitemapName of sitemapNames) {
|
|
990
|
+
if (sitemapName === "index")
|
|
991
|
+
continue;
|
|
992
|
+
const sitemapConfig = config.sitemaps[sitemapName];
|
|
992
993
|
addServerHandler({
|
|
993
994
|
route: withLeadingSlash(`${sitemapName}.xml`),
|
|
994
995
|
handler: resolve("./runtime/server/routes/sitemap/[sitemap].xml"),
|
|
995
996
|
lazy: true,
|
|
996
997
|
middleware: false
|
|
997
998
|
});
|
|
999
|
+
if (sitemapConfig.chunks) {
|
|
1000
|
+
addServerHandler({
|
|
1001
|
+
route: `/${sitemapName}-*.xml`,
|
|
1002
|
+
handler: resolve("./runtime/server/routes/sitemap/[sitemap].xml"),
|
|
1003
|
+
lazy: true,
|
|
1004
|
+
middleware: false
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
998
1007
|
}
|
|
999
1008
|
}
|
|
1000
1009
|
sitemaps.index = {
|
|
@@ -1008,7 +1017,7 @@ declare module 'vue-router' {
|
|
|
1008
1017
|
if (sitemapName === "index")
|
|
1009
1018
|
continue;
|
|
1010
1019
|
const definition = config.sitemaps[sitemapName];
|
|
1011
|
-
|
|
1020
|
+
const sitemapConfig = defu(
|
|
1012
1021
|
{
|
|
1013
1022
|
sitemapName,
|
|
1014
1023
|
_route: withBase(joinURL(config.sitemapsPathPrefix || "", `${sitemapName}.xml`), nuxt.options.app.baseURL || "/"),
|
|
@@ -1017,6 +1026,28 @@ declare module 'vue-router' {
|
|
|
1017
1026
|
{ ...definition, urls: void 0, sources: void 0 },
|
|
1018
1027
|
{ include: config.include, exclude: config.exclude }
|
|
1019
1028
|
);
|
|
1029
|
+
if (definition.chunks) {
|
|
1030
|
+
let chunkSize = config.defaultSitemapsChunkSize || 1e3;
|
|
1031
|
+
if (typeof definition.chunks === "number") {
|
|
1032
|
+
if (definition.chunks <= 0) {
|
|
1033
|
+
logger.warn(`Invalid chunks value (${definition.chunks}) for sitemap "${sitemapName}". Using default.`);
|
|
1034
|
+
} else {
|
|
1035
|
+
chunkSize = definition.chunks;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
if (definition.chunkSize !== void 0) {
|
|
1039
|
+
if (typeof definition.chunkSize !== "number" || definition.chunkSize <= 0) {
|
|
1040
|
+
logger.warn(`Invalid chunkSize value (${definition.chunkSize}) for sitemap "${sitemapName}". Using default.`);
|
|
1041
|
+
} else {
|
|
1042
|
+
chunkSize = definition.chunkSize;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
sitemapConfig._isChunking = true;
|
|
1046
|
+
sitemapConfig._chunkSize = chunkSize;
|
|
1047
|
+
sitemapConfig.chunks = definition.chunks;
|
|
1048
|
+
sitemapConfig.chunkSize = definition.chunkSize;
|
|
1049
|
+
}
|
|
1050
|
+
sitemaps[sitemapName] = sitemapConfig;
|
|
1020
1051
|
}
|
|
1021
1052
|
} else {
|
|
1022
1053
|
sitemaps.chunks = {
|
|
@@ -1118,6 +1149,14 @@ declare module 'vue-router' {
|
|
|
1118
1149
|
route: "/__sitemap__/debug.json",
|
|
1119
1150
|
handler: resolve("./runtime/server/routes/__sitemap__/debug")
|
|
1120
1151
|
});
|
|
1152
|
+
if (usingMultiSitemaps) {
|
|
1153
|
+
addServerHandler({
|
|
1154
|
+
route: "/__sitemap__/**:sitemap",
|
|
1155
|
+
handler: resolve("./runtime/server/routes/sitemap/[sitemap].xml"),
|
|
1156
|
+
lazy: true,
|
|
1157
|
+
middleware: true
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1121
1160
|
setupDevToolsUI(config, resolve);
|
|
1122
1161
|
}
|
|
1123
1162
|
const imports = [
|
|
@@ -4,20 +4,36 @@ import { useSitemapRuntimeConfig } from "../utils.js";
|
|
|
4
4
|
export default defineNitroPlugin((nitroApp) => {
|
|
5
5
|
const { sitemaps } = useSitemapRuntimeConfig();
|
|
6
6
|
const queue = [];
|
|
7
|
+
const timeoutIds = [];
|
|
7
8
|
const sitemapsWithRoutes = Object.entries(sitemaps).filter(([, sitemap]) => sitemap._route);
|
|
8
9
|
for (const [, sitemap] of sitemapsWithRoutes)
|
|
9
10
|
queue.push(() => nitroApp.localFetch(withLeadingSlash(sitemap._route), {}));
|
|
10
|
-
setTimeout(
|
|
11
|
+
const initialTimeout = setTimeout(
|
|
11
12
|
() => {
|
|
12
13
|
const next = async () => {
|
|
13
|
-
if (queue.length === 0)
|
|
14
|
+
if (queue.length === 0) {
|
|
15
|
+
timeoutIds.length = 0;
|
|
14
16
|
return;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
await queue.shift()();
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error("[sitemap:warm-up] Error warming up sitemap:", error);
|
|
22
|
+
}
|
|
23
|
+
if (queue.length > 0) {
|
|
24
|
+
const nextTimeout = setTimeout(next, 1e3);
|
|
25
|
+
timeoutIds.push(nextTimeout);
|
|
26
|
+
}
|
|
17
27
|
};
|
|
18
28
|
next();
|
|
19
29
|
},
|
|
20
30
|
2500
|
|
21
31
|
/* https://github.com/unjs/nitro/pull/1906 */
|
|
22
32
|
);
|
|
33
|
+
timeoutIds.push(initialTimeout);
|
|
34
|
+
nitroApp.hooks.hook("close", () => {
|
|
35
|
+
timeoutIds.forEach((id) => clearTimeout(id));
|
|
36
|
+
timeoutIds.length = 0;
|
|
37
|
+
queue.length = 0;
|
|
38
|
+
});
|
|
23
39
|
});
|
|
@@ -17,13 +17,13 @@ export default defineEventHandler(async (e) => {
|
|
|
17
17
|
for (const s of Object.keys(_sitemaps)) {
|
|
18
18
|
sitemaps[s] = {
|
|
19
19
|
..._sitemaps[s],
|
|
20
|
-
sources: await resolveSitemapSources(await childSitemapSources(_sitemaps[s]))
|
|
20
|
+
sources: await resolveSitemapSources(await childSitemapSources(_sitemaps[s]), e)
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
return {
|
|
24
24
|
nitroOrigin,
|
|
25
25
|
sitemaps,
|
|
26
26
|
runtimeConfig,
|
|
27
|
-
globalSources: await resolveSitemapSources(globalSources)
|
|
27
|
+
globalSources: await resolveSitemapSources(globalSources, e)
|
|
28
28
|
};
|
|
29
29
|
});
|
|
@@ -2,19 +2,49 @@ import { createError, defineEventHandler, getRouterParam } from "h3";
|
|
|
2
2
|
import { withoutLeadingSlash, withoutTrailingSlash } from "ufo";
|
|
3
3
|
import { useSitemapRuntimeConfig } from "../../utils.js";
|
|
4
4
|
import { createSitemap } from "../../sitemap/nitro.js";
|
|
5
|
+
import { parseChunkInfo, getSitemapConfig } from "../../sitemap/utils/chunk.js";
|
|
5
6
|
export default defineEventHandler(async (e) => {
|
|
6
7
|
const runtimeConfig = useSitemapRuntimeConfig(e);
|
|
7
8
|
const { sitemaps } = runtimeConfig;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
let sitemapName = getRouterParam(e, "sitemap");
|
|
10
|
+
if (!sitemapName) {
|
|
11
|
+
const path = e.path;
|
|
12
|
+
const match = path.match(/(?:\/__sitemap__\/)?([^/]+)\.xml$/);
|
|
13
|
+
if (match) {
|
|
14
|
+
sitemapName = match[1];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (!sitemapName) {
|
|
18
|
+
return createError({
|
|
19
|
+
statusCode: 400,
|
|
20
|
+
message: "Invalid sitemap request"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
sitemapName = withoutLeadingSlash(withoutTrailingSlash(sitemapName.replace(".xml", "").replace("__sitemap__/", "").replace(runtimeConfig.sitemapsPathPrefix || "", "")));
|
|
24
|
+
const chunkInfo = parseChunkInfo(sitemapName, sitemaps, runtimeConfig.defaultSitemapsChunkSize);
|
|
25
|
+
const isAutoChunked = typeof sitemaps.chunks !== "undefined" && !Number.isNaN(Number(sitemapName));
|
|
26
|
+
const sitemapExists = sitemapName in sitemaps || chunkInfo.baseSitemapName in sitemaps || isAutoChunked;
|
|
27
|
+
if (!sitemapExists) {
|
|
11
28
|
return createError({
|
|
12
29
|
statusCode: 404,
|
|
13
30
|
message: `Sitemap "${sitemapName}" not found.`
|
|
14
31
|
});
|
|
15
32
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
if (chunkInfo.isChunked && chunkInfo.chunkIndex !== void 0) {
|
|
34
|
+
const baseSitemap = sitemaps[chunkInfo.baseSitemapName];
|
|
35
|
+
if (baseSitemap && !baseSitemap.chunks && !baseSitemap._isChunking) {
|
|
36
|
+
return createError({
|
|
37
|
+
statusCode: 404,
|
|
38
|
+
message: `Sitemap "${chunkInfo.baseSitemapName}" does not support chunking.`
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (baseSitemap?._chunkCount !== void 0 && chunkInfo.chunkIndex >= baseSitemap._chunkCount) {
|
|
42
|
+
return createError({
|
|
43
|
+
statusCode: 404,
|
|
44
|
+
message: `Chunk ${chunkInfo.chunkIndex} does not exist for sitemap "${chunkInfo.baseSitemapName}".`
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const sitemapConfig = getSitemapConfig(sitemapName, sitemaps, runtimeConfig.defaultSitemapsChunkSize);
|
|
49
|
+
return createSitemap(e, sitemapConfig, runtimeConfig);
|
|
20
50
|
});
|
|
@@ -22,9 +22,17 @@ export default defineEventHandler(async (e) => {
|
|
|
22
22
|
const ctx = { sitemap: output, sitemapName: "sitemap", event: e };
|
|
23
23
|
await nitro.hooks.callHook("sitemap:output", ctx);
|
|
24
24
|
setHeader(e, "Content-Type", "text/xml; charset=UTF-8");
|
|
25
|
-
if (runtimeConfig.cacheMaxAgeSeconds)
|
|
26
|
-
setHeader(e, "Cache-Control", `public, max-age=${runtimeConfig.cacheMaxAgeSeconds},
|
|
27
|
-
|
|
25
|
+
if (runtimeConfig.cacheMaxAgeSeconds) {
|
|
26
|
+
setHeader(e, "Cache-Control", `public, max-age=${runtimeConfig.cacheMaxAgeSeconds}, s-maxage=${runtimeConfig.cacheMaxAgeSeconds}, stale-while-revalidate=3600`);
|
|
27
|
+
const now = /* @__PURE__ */ new Date();
|
|
28
|
+
setHeader(e, "X-Sitemap-Generated", now.toISOString());
|
|
29
|
+
setHeader(e, "X-Sitemap-Cache-Duration", `${runtimeConfig.cacheMaxAgeSeconds}s`);
|
|
30
|
+
const expiryTime = new Date(now.getTime() + runtimeConfig.cacheMaxAgeSeconds * 1e3);
|
|
31
|
+
setHeader(e, "X-Sitemap-Cache-Expires", expiryTime.toISOString());
|
|
32
|
+
const remainingSeconds = Math.floor((expiryTime.getTime() - now.getTime()) / 1e3);
|
|
33
|
+
setHeader(e, "X-Sitemap-Cache-Remaining", `${remainingSeconds}s`);
|
|
34
|
+
} else {
|
|
28
35
|
setHeader(e, "Cache-Control", `no-cache, no-store`);
|
|
36
|
+
}
|
|
29
37
|
return ctx.sitemap;
|
|
30
38
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NitroApp } from 'nitropack/types';
|
|
2
2
|
import type { ModuleRuntimeConfig, NitroUrlResolvers, SitemapIndexEntry } from '../../../types.js';
|
|
3
|
-
export declare function buildSitemapIndex(resolvers: NitroUrlResolvers, runtimeConfig: ModuleRuntimeConfig, nitro?: NitroApp): Promise<SitemapIndexEntry[]>;
|
|
4
3
|
export declare function urlsToIndexXml(sitemaps: SitemapIndexEntry[], resolvers: NitroUrlResolvers, { version, xsl, credits, minify }: Pick<ModuleRuntimeConfig, 'version' | 'xsl' | 'credits' | 'minify'>): string;
|
|
4
|
+
export declare function buildSitemapIndex(resolvers: NitroUrlResolvers, runtimeConfig: ModuleRuntimeConfig, nitro?: NitroApp): Promise<SitemapIndexEntry[]>;
|