@nuxtjs/sitemap 7.6.0 → 8.0.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/README.md +8 -2
- package/dist/content.d.mts +42 -69
- package/dist/content.d.ts +42 -69
- package/dist/content.mjs +57 -41
- package/dist/devtools/200.html +1 -0
- package/dist/devtools/404.html +1 -0
- package/dist/devtools/_fonts/4ppnHhMi-pBsWSPo7mY0avYxlDoAg1N3PTzCwXLZ5rA-d9oibkGnTd1JL3tc_xnaVgBLYmOB8kjrK2cvZaqwj9s.woff2 +0 -0
- package/dist/devtools/_fonts/4qBuU9MRVUlPZNPSF7Xom_sK8RBEnfYu-9VXFrdq8A8-8TDwLE1HAj1sQn7XxVWtM_7sIaPM-DTdO3Pf8U2DF1U.woff2 +0 -0
- package/dist/devtools/_fonts/6dYsbWUd_BpKJ7mdDihgOcya1gHXLpJBuMYXux3WMjE-q3fYNS8YbW5n7ZeXI2vSNgkRWW5VDPKAl51SNTjG2qk.woff2 +0 -0
- package/dist/devtools/_fonts/Lr-hqqZZsYmCt0ITUlr1CUrWim9fsKvoDFZliMxgNHY-iTa_Yt_PzhOY9TX7ZXdSlEPim6iRt92xhECwaxWxd5w.woff2 +0 -0
- package/dist/devtools/_fonts/OknHvWI6KtYn1JQBzX7eSpNDBQ8520F9TvSUJYkVf6A-xeZn9253svK_8Q2LD0XEruY_MnEsuCRO5LenPoggC0Y.woff2 +0 -0
- package/dist/devtools/_fonts/PV2hrQG6wq5BlIPDjdL1IcOflycaghyt5MHzlBqZtlo-lb_WexLz3VZqfTN0oi554iBH5tT2j2UFEV-XErCAS3E.woff2 +0 -0
- package/dist/devtools/_fonts/UA7OtwYHwGN_HjcVGTdmiQxUit7FlqkCwxVUWSeXVnQ-B4OXCFOL_tWrYODpQTc07aMaj0c2cewTOmBRWR9tD-A.woff2 +0 -0
- package/dist/devtools/_fonts/VE4cDVCv5MxbFM7ZLoLCGbIpNd71zhp7MDI9lmN5Y7I-xZyDYCUVrd6LV8eVGF3Um3UZjBFuUtDGtvdyTBBRYBo.woff2 +0 -0
- package/dist/devtools/_fonts/fVoGbnMbBFd5L9BBp9fUPavUSkZ_EmsQNSyadkT-108-U4T0khaeLQSIhtt9eVvaCEKJjtWJ4ioRJOf8hvqkWY0.woff2 +0 -0
- package/dist/devtools/_fonts/lQAxeCEs1R0Lw-H9XRU1RlOARQN8J6npRsPjyEDMe5s-_DUSLEkO3tKTuun_gSnDLoQPVEnpOnyqZMOw0ByZ6PA.woff2 +0 -0
- package/dist/devtools/_fonts/lntlqNHKLV2n82yTwMde70QqOjcfLE2XJ5oKZ3vRPWc-z6TxpIZQdWXztWLr9_OFWqt_WJJoeGtuK_-XQMZGQwE.woff2 +0 -0
- package/dist/devtools/_fonts/qxAYvKsXWeYv731eb-h5TRurcdIP_W44mpNdX-HABAk-zUDeMEFlNtNbrwvT9JxLEBg0TphGy70O6RfIoIX_ZwU.woff2 +0 -0
- package/dist/devtools/_nuxt/6-8YL5RT.js +1 -0
- package/dist/devtools/_nuxt/B-CoxLn7.js +1 -0
- package/dist/devtools/_nuxt/BBg_LgdD.js +1 -0
- package/dist/devtools/_nuxt/BFP26XjE.js +1 -0
- package/dist/devtools/_nuxt/BFxFqELk.js +1 -0
- package/dist/devtools/_nuxt/BJ46vUgN.js +22 -0
- package/dist/devtools/_nuxt/BK43-3Xm.js +1 -0
- package/dist/devtools/_nuxt/BUgp7PK5.js +1 -0
- package/dist/devtools/_nuxt/BUwCbG2W.js +1 -0
- package/dist/devtools/_nuxt/BgUkVPML.js +1 -0
- package/dist/devtools/_nuxt/Bl-ESRhh.js +1 -0
- package/dist/devtools/_nuxt/BpntLhpu.js +1 -0
- package/dist/devtools/_nuxt/CMkTWvG2.js +1 -0
- package/dist/devtools/_nuxt/CdSSkj0j.js +6 -0
- package/dist/devtools/_nuxt/Cfg7NvvP.js +3 -0
- package/dist/devtools/_nuxt/Cq2IBCZt.js +1 -0
- package/dist/devtools/_nuxt/D56-uEuD.js +1 -0
- package/dist/devtools/_nuxt/D9eL2h5z.js +1 -0
- package/dist/devtools/_nuxt/DC83McAa.js +154 -0
- package/dist/devtools/_nuxt/DLfyhkbV.js +1 -0
- package/dist/devtools/_nuxt/DRdBN13f.js +1 -0
- package/dist/devtools/_nuxt/DevtoolsEmptyState.CPam6VsX.css +1 -0
- package/dist/devtools/_nuxt/DevtoolsSection.BeqVO-za.css +1 -0
- package/dist/devtools/_nuxt/DuYBAn1h.js +1 -0
- package/dist/devtools/_nuxt/Source.ChvNXxeG.css +1 -0
- package/dist/devtools/_nuxt/_hKGTbzI.js +1 -0
- package/dist/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/devtools/_nuxt/builds/meta/8c443858-dba7-4dd0-b65e-6a31b3bbefed.json +1 -0
- package/dist/devtools/_nuxt/entry.DuwzcCXL.css +2 -0
- package/dist/devtools/_nuxt/error-404.CbnweSUu.css +1 -0
- package/dist/devtools/_nuxt/error-500.DrNDBqZi.css +1 -0
- package/dist/devtools/_nuxt/jxhrXVY1.js +1 -0
- package/dist/devtools/_nuxt/pages.CV7xHNff.css +1 -0
- package/dist/devtools/app-sources/index.html +1 -0
- package/dist/devtools/debug/index.html +1 -0
- package/dist/devtools/docs/index.html +1 -0
- package/dist/devtools/index.html +1 -0
- package/dist/devtools/user-sources/index.html +1 -0
- package/dist/module.d.mts +10 -1
- package/dist/module.d.ts +10 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +321 -430
- package/dist/runtime/server/composables/defineSitemapEventHandler.d.ts +1 -1
- package/dist/runtime/server/kit.d.ts +0 -1
- package/dist/runtime/server/kit.js +5 -7
- package/dist/runtime/server/plugins/warm-up.js +1 -1
- package/dist/runtime/server/robots-polyfill/getPathRobotConfig.d.ts +1 -1
- package/dist/runtime/server/robots-polyfill/getPathRobotConfig.js +1 -1
- package/dist/runtime/server/routes/__sitemap__/debug-production.d.ts +17 -0
- package/dist/runtime/server/routes/__sitemap__/debug-production.js +77 -0
- package/dist/runtime/server/routes/__sitemap__/debug.js +3 -3
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v2.js +1 -1
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +3 -3
- package/dist/runtime/server/routes/sitemap.xsl.js +4 -4
- package/dist/runtime/server/sitemap/builder/sitemap-index.js +8 -7
- package/dist/runtime/server/sitemap/builder/sitemap.d.ts +1 -1
- package/dist/runtime/server/sitemap/builder/sitemap.js +10 -8
- package/dist/runtime/server/sitemap/builder/xml.js +51 -25
- package/dist/runtime/server/sitemap/event-handlers.js +4 -4
- package/dist/runtime/server/sitemap/nitro.js +6 -6
- package/dist/runtime/server/sitemap/urlset/normalise.js +1 -1
- package/dist/runtime/server/sitemap/urlset/sources.js +2 -2
- package/dist/runtime/types.d.ts +5 -8
- package/dist/runtime/utils-pure.d.ts +3 -4
- package/dist/runtime/utils-pure.js +13 -41
- package/dist/shared/{sitemap.Bj0OAEtK.mjs → sitemap.B99ug6A9.mjs} +9 -5
- package/dist/utils.d.mts +9 -9
- package/dist/utils.d.ts +9 -9
- package/dist/utils.mjs +60 -59
- package/package.json +47 -46
- package/dist/client/200.html +0 -1
- package/dist/client/404.html +0 -1
- package/dist/client/_fonts/0xp3SbCWC1OhX7q1-uF6kilMZFm-alJNkUtkLTPCy_A-tN9KwPUWhhXvtqh74sU9FIkI4W6hsbm85r0X24hjOfM.woff2 +0 -0
- package/dist/client/_fonts/1ZTlEDqU4DtwDJiND8f6qaugUpa0RIDvQl-v7iM6l54-995OEiyou9G2dJsMNn9aLuHTFlgwosm_9gD5SQUWR40.woff +0 -0
- package/dist/client/_fonts/1ZTlEDqU4DtwDJiND8f6qaugUpa0RIDvQl-v7iM6l54-D6hedAgqRfOCLZzaShnyeAvlEnMzk4Wm7g9WDKWFHIc.woff +0 -0
- package/dist/client/_fonts/1ZTlEDqU4DtwDJiND8f6qaugUpa0RIDvQl-v7iM6l54-vrK12kZ24WGUghky9YxsOZpLH8Tt4jMU8XIvzgLQ6DU.woff +0 -0
- package/dist/client/_fonts/4HA9tc4y8BVQeLXvLn3JgQqilAj1xrAnUSprQGHIPSw-ZPswEL_UDOYaxTLQDUySPjoOHDxhD83pD19HMfKfK9s.woff2 +0 -0
- package/dist/client/_fonts/Bmul3LaKlc7BUKqJHE_UmEoF40Sg_2ga52yJjwyDcKs-TnYmYl1DNYkiWMu0Vx49DakCPBuiCCj9zoLIuQjUdKY.woff2 +0 -0
- package/dist/client/_fonts/DfgmjWGpWte3Q3a54Nevr_BYmMM5YEJXRI1CdI2VwO0-ox5RadQfCyVTmKl_hubTaIJjtRw9oaQz2GDBeZR6l1M.woff2 +0 -0
- package/dist/client/_fonts/LK8hREFNeTe-EIzvbfgusJBg3CJ7Q7NFgYIiGb2LZ8-qiyWl0ATLJjOsRPZC_7a8mTMFxEMKEv6JTK_kHtMzbM.woff2 +0 -0
- package/dist/client/_fonts/Lc_5lWuBuZcZ166p1-s-mnGkMJwIYJE_QDCkws8iCkI-r45Qbm2hCykrfOZ0kowz__uTTTUOPDN9hz34QcRNTY4.woff2 +0 -0
- package/dist/client/_fonts/UBlOS9e0BmJuiF5yVs0YcJrFWaa-iN8zx9TP_lmKs8c-iH3Naewt5UjJ0AQ38QZs4lkEo4zdjMIVkLs4y7EiwIE.woff2 +0 -0
- package/dist/client/_fonts/gRxGIWazSFZVyzU0s62U9IArK3RJLkOoUmXx0C8Npsw-kMFNQG6iwjw2nvqS3ut9jMSVn__HlJ28slvxjE4hYfc.woff2 +0 -0
- package/dist/client/_fonts/hIKtJJBMNYGPUppSYZpyuF6c24cKhBkhsgaCTgzYgqw-jRJyBPlfGDXClyrgfO6GK_Pfs1RmTsB-wWX6MOgpsRA.woff2 +0 -0
- package/dist/client/_fonts/iEvApgDRmzKzNqOYocBTrmcHZmuGAJloawKDP1S0nyE-T3oc_9We24QGwfw5naik4cM0g7VxylWVaQwKm4dy3cw.woff2 +0 -0
- package/dist/client/_fonts/kokcBTWRechd97ZdVUpUxrOFbsRt8whO21yA1vQ6iJ8-O7CCbVvFgg_MFLTdyFF9FMeMvIoEmxJLubqVDYTUoWY.woff2 +0 -0
- package/dist/client/_fonts/oFzdhjQtZFydTZ757bmiVFXgReR2bBSYm_CjQ7B1Jjs-F6oFbDhOWKYJbgrlC93wkLkPlIV7mzgvqwqEDxQMeHA.woff2 +0 -0
- package/dist/client/_nuxt/5ZF0DUKe.js +0 -1
- package/dist/client/_nuxt/8XcEHgiq.js +0 -1
- package/dist/client/_nuxt/B2G1Husz.js +0 -1
- package/dist/client/_nuxt/B6Rjxwce.js +0 -1
- package/dist/client/_nuxt/BTnenz-7.js +0 -1
- package/dist/client/_nuxt/BaarzCY9.js +0 -181
- package/dist/client/_nuxt/BeMtTGFX.js +0 -1
- package/dist/client/_nuxt/BgRd_GNf.js +0 -1
- package/dist/client/_nuxt/Bj_3pTUi.js +0 -1
- package/dist/client/_nuxt/BqgETAYZ.js +0 -1
- package/dist/client/_nuxt/C1-eNu7x.js +0 -1
- package/dist/client/_nuxt/C6MORWr4.js +0 -1
- package/dist/client/_nuxt/CIJ7g9su.js +0 -1
- package/dist/client/_nuxt/CINkxRg5.js +0 -1
- package/dist/client/_nuxt/COIEcBZR.js +0 -1
- package/dist/client/_nuxt/CVO1_9PV.js +0 -1
- package/dist/client/_nuxt/CZ3hLIr1.js +0 -1
- package/dist/client/_nuxt/Caedg1qp.js +0 -1
- package/dist/client/_nuxt/Cmw_hYOm.js +0 -1
- package/dist/client/_nuxt/Cp-IABpG.js +0 -1
- package/dist/client/_nuxt/CxFX6b0M.js +0 -1
- package/dist/client/_nuxt/D0r3Knsf.js +0 -1
- package/dist/client/_nuxt/D4YjxrHq.js +0 -1
- package/dist/client/_nuxt/DHOdika3.js +0 -1
- package/dist/client/_nuxt/DSdw0YSI.js +0 -1
- package/dist/client/_nuxt/DSxZHkX-.js +0 -1
- package/dist/client/_nuxt/Dn8lRF86.js +0 -1
- package/dist/client/_nuxt/DwNiGCgn.js +0 -1
- package/dist/client/_nuxt/O3qB0pnO.js +0 -1
- package/dist/client/_nuxt/ProsePre.D5orA6B_.css +0 -1
- package/dist/client/_nuxt/ZdghZ1ke.js +0 -1
- package/dist/client/_nuxt/aUtIlT-b.js +0 -1
- package/dist/client/_nuxt/builds/latest.json +0 -1
- package/dist/client/_nuxt/builds/meta/6319eec7-8aee-40f4-abcf-31c51d4b20a5.json +0 -1
- package/dist/client/_nuxt/entry.D1qdnVLM.css +0 -1
- package/dist/client/_nuxt/error-404.BBebgf1Y.css +0 -1
- package/dist/client/_nuxt/error-500.C4WF4yER.css +0 -1
- package/dist/client/index.html +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineEventHandler } from 'h3';
|
|
2
1
|
import type { EventHandlerRequest, EventHandlerResponse } from 'h3';
|
|
3
2
|
import type { SitemapUrlInput } from '../../types.js';
|
|
3
|
+
import { defineEventHandler } from 'h3';
|
|
4
4
|
export declare const defineSitemapEventHandler: typeof defineEventHandler<EventHandlerRequest, EventHandlerResponse<SitemapUrlInput[]>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
2
1
|
import { defu } from "defu";
|
|
3
|
-
import { parseURL, withoutBase, withoutTrailingSlash } from "ufo";
|
|
4
2
|
import { useRuntimeConfig } from "nitropack/runtime";
|
|
5
|
-
|
|
3
|
+
import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
4
|
+
import { parseURL, withoutBase, withoutTrailingSlash } from "ufo";
|
|
5
|
+
function withoutQuery(path) {
|
|
6
6
|
return path.split("?")[0];
|
|
7
7
|
}
|
|
8
8
|
export function createNitroRouteRuleMatcher() {
|
|
@@ -10,16 +10,14 @@ export function createNitroRouteRuleMatcher() {
|
|
|
10
10
|
const _routeRulesMatcher = toRouteMatcher(
|
|
11
11
|
createRadixRouter({
|
|
12
12
|
routes: Object.fromEntries(
|
|
13
|
-
Object.entries(nitro?.routeRules || {}).map(([path, rules]) => [
|
|
13
|
+
Object.entries(nitro?.routeRules || {}).map(([path, rules]) => [withoutTrailingSlash(path), rules])
|
|
14
14
|
)
|
|
15
15
|
})
|
|
16
16
|
);
|
|
17
17
|
return (pathOrUrl) => {
|
|
18
18
|
const path = pathOrUrl[0] === "/" ? pathOrUrl : parseURL(pathOrUrl, app.baseURL).pathname;
|
|
19
|
-
const pathWithoutQuery = withoutQuery(path);
|
|
20
19
|
return defu({}, ..._routeRulesMatcher.matchAll(
|
|
21
|
-
|
|
22
|
-
withoutBase(pathWithoutQuery === "/" ? pathWithoutQuery : withoutTrailingSlash(pathWithoutQuery), app.baseURL)
|
|
20
|
+
withoutBase(withoutTrailingSlash(withoutQuery(path)), app.baseURL)
|
|
23
21
|
).reverse());
|
|
24
22
|
};
|
|
25
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { withLeadingSlash } from "ufo";
|
|
2
1
|
import { defineNitroPlugin } from "nitropack/runtime";
|
|
2
|
+
import { withLeadingSlash } from "ufo";
|
|
3
3
|
import { useSitemapRuntimeConfig } from "../utils.js";
|
|
4
4
|
export default defineNitroPlugin((nitroApp) => {
|
|
5
5
|
const { sitemaps } = useSitemapRuntimeConfig();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SitemapWarning } from '../../../../utils/parseSitemapXml.js';
|
|
2
|
+
export interface ProductionSitemapEntry {
|
|
3
|
+
loc: string;
|
|
4
|
+
urlCount: number;
|
|
5
|
+
warnings: SitemapWarning[];
|
|
6
|
+
error?: string;
|
|
7
|
+
lastmod?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProductionDebugResponse {
|
|
10
|
+
url: string;
|
|
11
|
+
isIndex: boolean;
|
|
12
|
+
sitemaps: ProductionSitemapEntry[];
|
|
13
|
+
warnings: SitemapWarning[];
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<Record<string, any> | ProductionDebugResponse>>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { defineEventHandler, getQuery } from "h3";
|
|
2
|
+
import { isSitemapIndex, parseSitemapIndex } from "../../../../utils/parseSitemapIndex";
|
|
3
|
+
import { parseSitemapXml } from "../../../../utils/parseSitemapXml";
|
|
4
|
+
async function fetchXml(url) {
|
|
5
|
+
const response = await fetch(url, {
|
|
6
|
+
headers: { Accept: "application/xml, text/xml" },
|
|
7
|
+
signal: AbortSignal.timeout(15e3)
|
|
8
|
+
});
|
|
9
|
+
if (!response.ok)
|
|
10
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
11
|
+
return response.text();
|
|
12
|
+
}
|
|
13
|
+
export default defineEventHandler(async (e) => {
|
|
14
|
+
const { url, mode } = getQuery(e);
|
|
15
|
+
if (!url || typeof url !== "string")
|
|
16
|
+
return { url: "", isIndex: false, sitemaps: [], warnings: [], error: "Missing url query parameter" };
|
|
17
|
+
if (mode === "debug") {
|
|
18
|
+
const debugUrl = `${url.replace(/\/$/, "")}/__sitemap__/debug.json`;
|
|
19
|
+
const response = await fetch(debugUrl, {
|
|
20
|
+
headers: { Accept: "application/json" },
|
|
21
|
+
signal: AbortSignal.timeout(1e4)
|
|
22
|
+
}).catch(() => null);
|
|
23
|
+
if (response?.ok) {
|
|
24
|
+
const json = await response.json().catch(() => null);
|
|
25
|
+
if (json?.sitemaps)
|
|
26
|
+
return json;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const sitemapUrl = url.endsWith("/") ? `${url}sitemap.xml` : url;
|
|
30
|
+
const xml = await fetchXml(sitemapUrl).catch((err) => {
|
|
31
|
+
return err;
|
|
32
|
+
});
|
|
33
|
+
if (xml instanceof Error)
|
|
34
|
+
return { url: sitemapUrl, isIndex: false, sitemaps: [], warnings: [], error: `Failed to fetch sitemap: ${xml.message}` };
|
|
35
|
+
if (isSitemapIndex(xml)) {
|
|
36
|
+
const { entries, warnings } = parseSitemapIndex(xml);
|
|
37
|
+
const sitemaps = await Promise.all(
|
|
38
|
+
entries.map(async (entry) => {
|
|
39
|
+
const childXml = await fetchXml(entry.loc).catch((err) => err);
|
|
40
|
+
if (childXml instanceof Error) {
|
|
41
|
+
return {
|
|
42
|
+
loc: entry.loc,
|
|
43
|
+
urlCount: 0,
|
|
44
|
+
warnings: [],
|
|
45
|
+
error: childXml.message,
|
|
46
|
+
lastmod: entry.lastmod
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const result2 = await parseSitemapXml(childXml).catch((err) => ({
|
|
50
|
+
urls: [],
|
|
51
|
+
warnings: [{ type: "validation", message: err.message }]
|
|
52
|
+
}));
|
|
53
|
+
return {
|
|
54
|
+
loc: entry.loc,
|
|
55
|
+
urlCount: result2.urls.length,
|
|
56
|
+
warnings: result2.warnings,
|
|
57
|
+
lastmod: entry.lastmod
|
|
58
|
+
};
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
return { url: sitemapUrl, isIndex: true, sitemaps, warnings };
|
|
62
|
+
}
|
|
63
|
+
const result = await parseSitemapXml(xml).catch((err) => ({
|
|
64
|
+
urls: [],
|
|
65
|
+
warnings: [{ type: "validation", message: err.message }]
|
|
66
|
+
}));
|
|
67
|
+
return {
|
|
68
|
+
url: sitemapUrl,
|
|
69
|
+
isIndex: false,
|
|
70
|
+
sitemaps: [{
|
|
71
|
+
loc: sitemapUrl,
|
|
72
|
+
urlCount: result.urls.length,
|
|
73
|
+
warnings: result.warnings
|
|
74
|
+
}],
|
|
75
|
+
warnings: []
|
|
76
|
+
};
|
|
77
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { getNitroOrigin, getSiteConfig } from "#site-config/server/composables";
|
|
1
2
|
import { defineEventHandler } from "h3";
|
|
2
|
-
import {
|
|
3
|
+
import { validateSitemapUrl } from "../../sitemap/urlset/normalise.js";
|
|
3
4
|
import {
|
|
4
5
|
childSitemapSources,
|
|
5
6
|
globalSitemapSources,
|
|
6
7
|
resolveSitemapSources
|
|
7
8
|
} from "../../sitemap/urlset/sources.js";
|
|
8
|
-
import {
|
|
9
|
-
import { getNitroOrigin, getSiteConfig } from "#site-config/server/composables";
|
|
9
|
+
import { useSitemapRuntimeConfig } from "../../utils.js";
|
|
10
10
|
function attachUrlWarnings(sources) {
|
|
11
11
|
for (const source of sources) {
|
|
12
12
|
if (!source.urls?.length)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
2
1
|
import { serverQueryContent } from "#content/server";
|
|
2
|
+
import { defineEventHandler } from "h3";
|
|
3
3
|
export default defineEventHandler(async (e) => {
|
|
4
4
|
const contentList = await serverQueryContent(e).find();
|
|
5
5
|
return contentList.map((c) => c.sitemap).filter(Boolean);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
2
|
-
import { queryCollection } from "@nuxt/content/server";
|
|
3
1
|
import manifest from "#content/manifest";
|
|
4
2
|
import { filters } from "#sitemap/content-filters";
|
|
5
3
|
import { onUrlFns } from "#sitemap/content-on-url";
|
|
4
|
+
import { queryCollection } from "@nuxt/content/server";
|
|
5
|
+
import { defineEventHandler } from "h3";
|
|
6
6
|
export default defineEventHandler(async (e) => {
|
|
7
7
|
const collections = [];
|
|
8
8
|
for (const collection in manifest) {
|
|
@@ -25,7 +25,7 @@ export default defineEventHandler(async (e) => {
|
|
|
25
25
|
const results = await Promise.all(contentList);
|
|
26
26
|
return results.flatMap(({ collection, entries }) => {
|
|
27
27
|
const onUrl = onUrlFns?.get(collection);
|
|
28
|
-
return entries.filter((c) => c.sitemap !== false && c.path).map((c) => {
|
|
28
|
+
return entries.filter((c) => c.sitemap !== false && c.path && !c.path.endsWith(".navigation")).map((c) => {
|
|
29
29
|
const url = {
|
|
30
30
|
loc: c.path,
|
|
31
31
|
...typeof c.sitemap === "object" ? c.sitemap : {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSiteConfig } from "#site-config/server/composables";
|
|
2
|
+
import { createSitePathResolver } from "#site-config/server/composables/utils";
|
|
3
|
+
import { defineEventHandler, getHeader, getQuery as h3GetQuery, setHeader } from "h3";
|
|
2
4
|
import { getQuery, parseURL, withQuery } from "ufo";
|
|
3
5
|
import { useSitemapRuntimeConfig, xmlEscape } from "../utils.js";
|
|
4
|
-
import { useSiteConfig } from "#site-config/server/composables/useSiteConfig";
|
|
5
|
-
import { createSitePathResolver } from "#site-config/server/composables/utils";
|
|
6
6
|
export default defineEventHandler(async (e) => {
|
|
7
7
|
const fixPath = createSitePathResolver(e, { absolute: false, withBase: true });
|
|
8
8
|
const { sitemapName: fallbackSitemapName, cacheMaxAgeSeconds, version, xslColumns, xslTips } = useSitemapRuntimeConfig();
|
|
@@ -11,7 +11,7 @@ export default defineEventHandler(async (e) => {
|
|
|
11
11
|
setHeader(e, "Cache-Control", `public, max-age=${cacheMaxAgeSeconds}, must-revalidate`);
|
|
12
12
|
else
|
|
13
13
|
setHeader(e, "Cache-Control", `no-cache, no-store`);
|
|
14
|
-
const { name: siteName, url: siteUrl } =
|
|
14
|
+
const { name: siteName, url: siteUrl } = getSiteConfig(e);
|
|
15
15
|
const referrer = getHeader(e, "Referer") || "/";
|
|
16
16
|
const referrerPath = parseURL(referrer).pathname;
|
|
17
17
|
const isNotIndexButHasIndex = referrerPath !== "/sitemap.xml" && referrerPath !== "/sitemap_index.xml" && referrerPath.endsWith(".xml");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defu } from "defu";
|
|
2
|
-
import { joinURL, withQuery } from "ufo";
|
|
3
|
-
import { defineCachedFunction } from "nitropack/runtime";
|
|
4
2
|
import { getHeader } from "h3";
|
|
3
|
+
import { defineCachedFunction, useRuntimeConfig } from "nitropack/runtime";
|
|
4
|
+
import { joinURL, withQuery } from "ufo";
|
|
5
5
|
import { normaliseDate } from "../urlset/normalise.js";
|
|
6
|
-
import { globalSitemapSources, childSitemapSources, resolveSitemapSources } from "../urlset/sources.js";
|
|
7
6
|
import { sortInPlace } from "../urlset/sort.js";
|
|
8
|
-
import {
|
|
7
|
+
import { childSitemapSources, globalSitemapSources, resolveSitemapSources } from "../urlset/sources.js";
|
|
9
8
|
import { resolveSitemapEntries } from "./sitemap.js";
|
|
9
|
+
import { escapeValueForXml } from "./xml.js";
|
|
10
10
|
const buildSitemapIndexCached = defineCachedFunction(
|
|
11
11
|
async (event, resolvers, runtimeConfig, nitro) => {
|
|
12
12
|
return buildSitemapIndexInternal(resolvers, runtimeConfig, nitro);
|
|
@@ -47,7 +47,8 @@ async function buildSitemapIndexInternal(resolvers, runtimeConfig, nitro) {
|
|
|
47
47
|
const chunks = {};
|
|
48
48
|
const allFailedSources = [];
|
|
49
49
|
for (const sitemapName in sitemaps) {
|
|
50
|
-
if (sitemapName === "index" || sitemapName === "chunks")
|
|
50
|
+
if (sitemapName === "index" || sitemapName === "chunks")
|
|
51
|
+
continue;
|
|
51
52
|
const sitemapConfig = sitemaps[sitemapName];
|
|
52
53
|
if (sitemapConfig.chunks || sitemapConfig._isChunking) {
|
|
53
54
|
sitemapConfig._isChunking = true;
|
|
@@ -80,7 +81,7 @@ async function buildSitemapIndexInternal(resolvers, runtimeConfig, nitro) {
|
|
|
80
81
|
event: resolvers.event
|
|
81
82
|
};
|
|
82
83
|
await nitro?.hooks.callHook("sitemap:input", resolvedCtx);
|
|
83
|
-
const normalisedUrls = resolveSitemapEntries(sitemap, resolvedCtx.urls, { autoI18n, isI18nMapped }, resolvers);
|
|
84
|
+
const normalisedUrls = resolveSitemapEntries(sitemap, resolvedCtx.urls, { autoI18n, isI18nMapped }, resolvers, useRuntimeConfig().app.baseURL);
|
|
84
85
|
const enhancedUrls = normalisedUrls.map((e) => defu(e, sitemap.defaults));
|
|
85
86
|
const sortedUrls = maybeSort(enhancedUrls);
|
|
86
87
|
sortedUrls.forEach((url, i) => {
|
|
@@ -129,7 +130,7 @@ async function buildSitemapIndexInternal(resolvers, runtimeConfig, nitro) {
|
|
|
129
130
|
event: resolvers.event
|
|
130
131
|
};
|
|
131
132
|
await nitro?.hooks.callHook("sitemap:input", resolvedCtx);
|
|
132
|
-
const normalisedUrls = resolveSitemapEntries(sitemapConfig, resolvedCtx.urls, { autoI18n, isI18nMapped }, resolvers);
|
|
133
|
+
const normalisedUrls = resolveSitemapEntries(sitemapConfig, resolvedCtx.urls, { autoI18n, isI18nMapped }, resolvers, useRuntimeConfig().app.baseURL);
|
|
133
134
|
const totalUrls = normalisedUrls.length;
|
|
134
135
|
const chunkCount = Math.ceil(totalUrls / chunkSize);
|
|
135
136
|
sitemapConfig._chunkCount = chunkCount;
|
|
@@ -5,7 +5,7 @@ export interface NormalizedI18n extends ResolvedSitemapUrl {
|
|
|
5
5
|
_locale: AutoI18nConfig['locales'][number];
|
|
6
6
|
_index?: number;
|
|
7
7
|
}
|
|
8
|
-
export declare function resolveSitemapEntries(sitemap: SitemapDefinition, urls: SitemapUrlInput[], runtimeConfig: Pick<ModuleRuntimeConfig, 'autoI18n' | 'isI18nMapped'>, resolvers?: NitroUrlResolvers): ResolvedSitemapUrl[];
|
|
8
|
+
export declare function resolveSitemapEntries(sitemap: SitemapDefinition, urls: SitemapUrlInput[], runtimeConfig: Pick<ModuleRuntimeConfig, 'autoI18n' | 'isI18nMapped'>, resolvers?: NitroUrlResolvers, baseURL?: string): ResolvedSitemapUrl[];
|
|
9
9
|
export declare function buildSitemapUrls(sitemap: SitemapDefinition, resolvers: NitroUrlResolvers, runtimeConfig: ModuleRuntimeConfig, nitro?: NitroApp): Promise<{
|
|
10
10
|
urls: ResolvedSitemapUrl[];
|
|
11
11
|
failedSources: Array<{
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nitropack/runtime";
|
|
1
2
|
import { resolveSitePath } from "nuxt-site-config/urls";
|
|
2
3
|
import { joinURL, withHttps } from "ufo";
|
|
4
|
+
import { applyDynamicParams, createPathFilter, findPageMapping, logger, splitForLocales } from "../../../utils-pure.js";
|
|
3
5
|
import { preNormalizeEntry } from "../urlset/normalise.js";
|
|
4
|
-
import { childSitemapSources, globalSitemapSources, resolveSitemapSources } from "../urlset/sources.js";
|
|
5
6
|
import { sortInPlace } from "../urlset/sort.js";
|
|
6
|
-
import {
|
|
7
|
+
import { childSitemapSources, globalSitemapSources, resolveSitemapSources } from "../urlset/sources.js";
|
|
7
8
|
import { parseChunkInfo, sliceUrlsForChunk } from "../utils/chunk.js";
|
|
8
|
-
export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
|
|
9
|
+
export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers, baseURL) {
|
|
9
10
|
const {
|
|
10
11
|
autoI18n,
|
|
11
12
|
isI18nMapped
|
|
@@ -13,7 +14,7 @@ export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
|
|
|
13
14
|
const filterPath = createPathFilter({
|
|
14
15
|
include: sitemap.include,
|
|
15
16
|
exclude: sitemap.exclude
|
|
16
|
-
});
|
|
17
|
+
}, baseURL || "/");
|
|
17
18
|
const _urls = urls.map((_e) => {
|
|
18
19
|
const e = preNormalizeEntry(_e, resolvers);
|
|
19
20
|
if (!e.loc || !filterPath(e.loc))
|
|
@@ -220,12 +221,13 @@ export async function buildSitemapUrls(sitemap, resolvers, runtimeConfig, nitro)
|
|
|
220
221
|
event: resolvers.event
|
|
221
222
|
};
|
|
222
223
|
await nitro?.hooks.callHook("sitemap:input", resolvedCtx);
|
|
223
|
-
const enhancedUrls = resolveSitemapEntries(sitemap, resolvedCtx.urls, { autoI18n, isI18nMapped }, resolvers);
|
|
224
|
+
const enhancedUrls = resolveSitemapEntries(sitemap, resolvedCtx.urls, { autoI18n, isI18nMapped }, resolvers, useRuntimeConfig().app.baseURL);
|
|
224
225
|
if (isMultiSitemap) {
|
|
225
226
|
const sitemapNames = Object.keys(sitemaps).filter((k) => k !== "index");
|
|
226
227
|
const warnedSitemaps = nitro?._sitemapWarnedSitemaps || /* @__PURE__ */ new Set();
|
|
227
228
|
for (const e of enhancedUrls) {
|
|
228
|
-
|
|
229
|
+
const hasMatchingSitemap = typeof e._sitemap === "string" && (sitemapNames.includes(e._sitemap) || isI18nMapped && sitemapNames.some((name) => name.startsWith(`${e._sitemap}-`)));
|
|
230
|
+
if (typeof e._sitemap === "string" && !hasMatchingSitemap) {
|
|
229
231
|
if (!warnedSitemaps.has(e._sitemap)) {
|
|
230
232
|
warnedSitemaps.add(e._sitemap);
|
|
231
233
|
logger.error(`Sitemap \`${e._sitemap}\` not found in sitemap config. Available sitemaps: ${sitemapNames.join(", ")}. Entry \`${e.loc}\` will be omitted.`);
|
|
@@ -241,8 +243,8 @@ export async function buildSitemapUrls(sitemap, resolvers, runtimeConfig, nitro)
|
|
|
241
243
|
return false;
|
|
242
244
|
if (isMultiSitemap && e._sitemap && sitemap.sitemapName) {
|
|
243
245
|
if (sitemap._isChunking)
|
|
244
|
-
return sitemap.sitemapName.startsWith(e._sitemap
|
|
245
|
-
return e._sitemap === sitemap.sitemapName;
|
|
246
|
+
return e._sitemap === baseSitemapName || isI18nMapped && sitemap.sitemapName.startsWith(`${e._sitemap}-`);
|
|
247
|
+
return e._sitemap === sitemap.sitemapName || isI18nMapped && sitemap.sitemapName.startsWith(`${e._sitemap}-`);
|
|
246
248
|
}
|
|
247
249
|
return true;
|
|
248
250
|
});
|
|
@@ -5,13 +5,18 @@ export function escapeValueForXml(value) {
|
|
|
5
5
|
return value ? "yes" : "no";
|
|
6
6
|
return xmlEscape(String(value));
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
function yesNo(v) {
|
|
9
|
+
return v === "yes" || v === true ? "yes" : "no";
|
|
10
|
+
}
|
|
9
11
|
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">';
|
|
10
12
|
function buildUrlXml(url, NL, I1, I2, I3, I4) {
|
|
11
13
|
let xml = `${I1}<url>${NL}`;
|
|
12
|
-
if (url.loc)
|
|
13
|
-
|
|
14
|
-
if (url.
|
|
14
|
+
if (url.loc)
|
|
15
|
+
xml += `${I2}<loc>${xmlEscape(url.loc)}</loc>${NL}`;
|
|
16
|
+
if (url.lastmod)
|
|
17
|
+
xml += `${I2}<lastmod>${url.lastmod}</lastmod>${NL}`;
|
|
18
|
+
if (url.changefreq)
|
|
19
|
+
xml += `${I2}<changefreq>${url.changefreq}</changefreq>${NL}`;
|
|
15
20
|
if (url.priority !== void 0) {
|
|
16
21
|
const p = typeof url.priority === "number" ? url.priority : Number.parseFloat(url.priority);
|
|
17
22
|
xml += `${I2}<priority>${p.toFixed(1)}</priority>${NL}`;
|
|
@@ -26,29 +31,45 @@ function buildUrlXml(url, NL, I1, I2, I3, I4) {
|
|
|
26
31
|
if (url.images) {
|
|
27
32
|
for (const img of url.images) {
|
|
28
33
|
xml += `${I2}<image:image>${NL}${I3}<image:loc>${xmlEscape(img.loc)}</image:loc>${NL}`;
|
|
29
|
-
if (img.title)
|
|
30
|
-
|
|
31
|
-
if (img.
|
|
32
|
-
|
|
34
|
+
if (img.title)
|
|
35
|
+
xml += `${I3}<image:title>${xmlEscape(img.title)}</image:title>${NL}`;
|
|
36
|
+
if (img.caption)
|
|
37
|
+
xml += `${I3}<image:caption>${xmlEscape(img.caption)}</image:caption>${NL}`;
|
|
38
|
+
if (img.geo_location)
|
|
39
|
+
xml += `${I3}<image:geo_location>${xmlEscape(img.geo_location)}</image:geo_location>${NL}`;
|
|
40
|
+
if (img.license)
|
|
41
|
+
xml += `${I3}<image:license>${xmlEscape(img.license)}</image:license>${NL}`;
|
|
33
42
|
xml += `${I2}</image:image>${NL}`;
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
45
|
if (url.videos) {
|
|
37
46
|
for (const video of url.videos) {
|
|
38
47
|
xml += `${I2}<video:video>${NL}${I3}<video:title>${xmlEscape(video.title)}</video:title>${NL}`;
|
|
39
|
-
if (video.thumbnail_loc)
|
|
48
|
+
if (video.thumbnail_loc)
|
|
49
|
+
xml += `${I3}<video:thumbnail_loc>${xmlEscape(video.thumbnail_loc)}</video:thumbnail_loc>${NL}`;
|
|
40
50
|
xml += `${I3}<video:description>${xmlEscape(video.description)}</video:description>${NL}`;
|
|
41
|
-
if (video.content_loc)
|
|
42
|
-
|
|
43
|
-
if (video.
|
|
44
|
-
|
|
45
|
-
if (video.
|
|
46
|
-
|
|
47
|
-
if (video.
|
|
48
|
-
|
|
49
|
-
if (video.
|
|
50
|
-
|
|
51
|
-
if (video.
|
|
51
|
+
if (video.content_loc)
|
|
52
|
+
xml += `${I3}<video:content_loc>${xmlEscape(video.content_loc)}</video:content_loc>${NL}`;
|
|
53
|
+
if (video.player_loc)
|
|
54
|
+
xml += `${I3}<video:player_loc>${xmlEscape(video.player_loc)}</video:player_loc>${NL}`;
|
|
55
|
+
if (video.duration !== void 0)
|
|
56
|
+
xml += `${I3}<video:duration>${video.duration}</video:duration>${NL}`;
|
|
57
|
+
if (video.expiration_date)
|
|
58
|
+
xml += `${I3}<video:expiration_date>${video.expiration_date}</video:expiration_date>${NL}`;
|
|
59
|
+
if (video.rating !== void 0)
|
|
60
|
+
xml += `${I3}<video:rating>${video.rating}</video:rating>${NL}`;
|
|
61
|
+
if (video.view_count !== void 0)
|
|
62
|
+
xml += `${I3}<video:view_count>${video.view_count}</video:view_count>${NL}`;
|
|
63
|
+
if (video.publication_date)
|
|
64
|
+
xml += `${I3}<video:publication_date>${video.publication_date}</video:publication_date>${NL}`;
|
|
65
|
+
if (video.family_friendly !== void 0)
|
|
66
|
+
xml += `${I3}<video:family_friendly>${yesNo(video.family_friendly)}</video:family_friendly>${NL}`;
|
|
67
|
+
if (video.restriction)
|
|
68
|
+
xml += `${I3}<video:restriction relationship="${video.restriction.relationship || "allow"}">${xmlEscape(video.restriction.restriction)}</video:restriction>${NL}`;
|
|
69
|
+
if (video.platform)
|
|
70
|
+
xml += `${I3}<video:platform relationship="${video.platform.relationship || "allow"}">${xmlEscape(video.platform.platform)}</video:platform>${NL}`;
|
|
71
|
+
if (video.requires_subscription !== void 0)
|
|
72
|
+
xml += `${I3}<video:requires_subscription>${yesNo(video.requires_subscription)}</video:requires_subscription>${NL}`;
|
|
52
73
|
if (video.price) {
|
|
53
74
|
for (const price of video.price) {
|
|
54
75
|
const c = price.currency ? ` currency="${price.currency}"` : "";
|
|
@@ -60,13 +81,16 @@ function buildUrlXml(url, NL, I1, I2, I3, I4) {
|
|
|
60
81
|
const info = video.uploader.info ? ` info="${xmlEscape(video.uploader.info)}"` : "";
|
|
61
82
|
xml += `${I3}<video:uploader${info}>${xmlEscape(video.uploader.uploader)}</video:uploader>${NL}`;
|
|
62
83
|
}
|
|
63
|
-
if (video.live !== void 0)
|
|
84
|
+
if (video.live !== void 0)
|
|
85
|
+
xml += `${I3}<video:live>${yesNo(video.live)}</video:live>${NL}`;
|
|
64
86
|
if (video.tag) {
|
|
65
87
|
const tags = Array.isArray(video.tag) ? video.tag : [video.tag];
|
|
66
88
|
for (const t of tags) xml += `${I3}<video:tag>${xmlEscape(t)}</video:tag>${NL}`;
|
|
67
89
|
}
|
|
68
|
-
if (video.category)
|
|
69
|
-
|
|
90
|
+
if (video.category)
|
|
91
|
+
xml += `${I3}<video:category>${xmlEscape(video.category)}</video:category>${NL}`;
|
|
92
|
+
if (video.gallery_loc)
|
|
93
|
+
xml += `${I3}<video:gallery_loc>${xmlEscape(video.gallery_loc)}</video:gallery_loc>${NL}`;
|
|
70
94
|
xml += `${I2}</video:video>${NL}`;
|
|
71
95
|
}
|
|
72
96
|
}
|
|
@@ -75,8 +99,10 @@ function buildUrlXml(url, NL, I1, I2, I3, I4) {
|
|
|
75
99
|
xml += `${I4}<news:name>${xmlEscape(url.news.publication.name)}</news:name>${NL}`;
|
|
76
100
|
xml += `${I4}<news:language>${xmlEscape(url.news.publication.language)}</news:language>${NL}`;
|
|
77
101
|
xml += `${I3}</news:publication>${NL}`;
|
|
78
|
-
if (url.news.title)
|
|
79
|
-
|
|
102
|
+
if (url.news.title)
|
|
103
|
+
xml += `${I3}<news:title>${xmlEscape(url.news.title)}</news:title>${NL}`;
|
|
104
|
+
if (url.news.publication_date)
|
|
105
|
+
xml += `${I3}<news:publication_date>${url.news.publication_date}</news:publication_date>${NL}`;
|
|
80
106
|
xml += `${I2}</news:news>${NL}`;
|
|
81
107
|
}
|
|
82
108
|
if (import.meta.dev && url._warnings?.length) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { appendHeader, createError, getRouterParam, sendRedirect, setHeader } from "h3";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useNitroApp, useRuntimeConfig } from "nitropack/runtime";
|
|
3
|
+
import { joinURL, withBase, withLeadingSlash, withoutLeadingSlash, withoutTrailingSlash } from "ufo";
|
|
4
4
|
import { useSitemapRuntimeConfig } from "../utils.js";
|
|
5
|
-
import { createSitemap, useNitroUrlResolvers } from "./nitro.js";
|
|
6
5
|
import { buildSitemapIndex, urlsToIndexXml } from "./builder/sitemap-index.js";
|
|
7
|
-
import {
|
|
6
|
+
import { createSitemap, useNitroUrlResolvers } from "./nitro.js";
|
|
7
|
+
import { getSitemapConfig, parseChunkInfo } from "./utils/chunk.js";
|
|
8
8
|
export async function sitemapXmlEventHandler(e) {
|
|
9
9
|
const runtimeConfig = useSitemapRuntimeConfig();
|
|
10
10
|
const { sitemaps } = runtimeConfig;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getPathRobotConfig } from "#internal/nuxt-robots/getPathRobotConfig";
|
|
2
|
+
import { getSiteConfig } from "#site-config/server/composables/getSiteConfig";
|
|
3
|
+
import { createSitePathResolver } from "#site-config/server/composables/utils";
|
|
3
4
|
import { defu } from "defu";
|
|
4
|
-
import {
|
|
5
|
+
import { createError, getHeader, getQuery, setHeader } from "h3";
|
|
6
|
+
import { defineCachedFunction, useNitroApp } from "nitropack/runtime";
|
|
7
|
+
import { fixSlashes } from "nuxt-site-config/urls";
|
|
5
8
|
import { logger, mergeOnKey, splitForLocales } from "../../utils-pure.js";
|
|
6
9
|
import { createNitroRouteRuleMatcher } from "../kit.js";
|
|
7
10
|
import { buildSitemapUrls, urlsToXml } from "./builder/sitemap.js";
|
|
8
11
|
import { normaliseEntry, preNormalizeEntry } from "./urlset/normalise.js";
|
|
9
12
|
import { sortInPlace } from "./urlset/sort.js";
|
|
10
|
-
import { getPathRobotConfig } from "#internal/nuxt-robots/getPathRobotConfig";
|
|
11
|
-
import { getSiteConfig } from "#site-config/server/composables/getSiteConfig";
|
|
12
|
-
import { createSitePathResolver } from "#site-config/server/composables/utils";
|
|
13
13
|
export function useNitroUrlResolvers(e) {
|
|
14
14
|
const canonicalQuery = getQuery(e).canonical;
|
|
15
15
|
const isShowingCanonical = typeof canonicalQuery !== "undefined" && canonicalQuery !== "false";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defu } from "defu";
|
|
1
2
|
import {
|
|
2
3
|
encodePath,
|
|
3
4
|
hasProtocol,
|
|
@@ -8,7 +9,6 @@ import {
|
|
|
8
9
|
stringifyQuery,
|
|
9
10
|
withoutTrailingSlash
|
|
10
11
|
} from "ufo";
|
|
11
|
-
import { defu } from "defu";
|
|
12
12
|
import { mergeOnKey } from "../../../utils-pure.js";
|
|
13
13
|
const VALID_CHANGEFREQ = ["always", "hourly", "daily", "weekly", "monthly", "yearly", "never"];
|
|
14
14
|
export function validateSitemapUrl(url) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseSitemapXml } from "@nuxtjs/sitemap/utils";
|
|
2
2
|
import { defu } from "defu";
|
|
3
|
+
import { getRequestHost } from "h3";
|
|
3
4
|
import { parseURL } from "ufo";
|
|
4
5
|
import { logger } from "../../../utils-pure.js";
|
|
5
|
-
import { parseSitemapXml } from "@nuxtjs/sitemap/utils";
|
|
6
6
|
export function normalizeSourceInput(source) {
|
|
7
7
|
if (typeof source === "string") {
|
|
8
8
|
return { context: { name: "hook" }, fetch: source };
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NuxtI18nOptions } from '@nuxtjs/i18n';
|
|
2
2
|
import type { H3Event } from 'h3';
|
|
3
|
+
import type { FetchOptions } from 'ofetch';
|
|
3
4
|
import type { ParsedURL } from 'ufo';
|
|
4
|
-
import type { NuxtI18nOptions } from '@nuxtjs/i18n';
|
|
5
5
|
export interface ModuleOptions extends SitemapDefinition {
|
|
6
6
|
/**
|
|
7
7
|
* Whether the sitemap.xml should be generated.
|
|
@@ -206,10 +206,10 @@ interface LocaleObject extends Record<string, any> {
|
|
|
206
206
|
path: string;
|
|
207
207
|
cache?: boolean;
|
|
208
208
|
};
|
|
209
|
-
files?: string
|
|
209
|
+
files?: (string | {
|
|
210
210
|
path: string;
|
|
211
211
|
cache?: boolean;
|
|
212
|
-
}[];
|
|
212
|
+
})[];
|
|
213
213
|
isCatchallLocale?: boolean;
|
|
214
214
|
/**
|
|
215
215
|
* @deprecated in v9, use `language` instead
|
|
@@ -490,8 +490,5 @@ export interface NitroUrlResolvers {
|
|
|
490
490
|
relativeBaseUrlResolver: (path: string) => string;
|
|
491
491
|
fixSlashes: (path: string) => string;
|
|
492
492
|
}
|
|
493
|
-
|
|
494
|
-
includeDefaultLocaleRoute?: boolean;
|
|
495
|
-
}
|
|
496
|
-
export type I18nIntegrationOptions = NuxtI18nOptions & NuxtI18nMicro;
|
|
493
|
+
export type I18nIntegrationOptions = NuxtI18nOptions;
|
|
497
494
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FilterInput } from './types.js';
|
|
2
|
+
export { createFilter, type CreateFilterOptions } from 'nuxtseo-shared/utils';
|
|
2
3
|
export declare const logger: import("consola").ConsolaInstance;
|
|
3
4
|
export declare function mergeOnKey<T, K extends keyof T>(arr: T[], key: K): T[];
|
|
4
5
|
export declare function splitForLocales(path: string, locales: string[]): [string | null, string];
|
|
@@ -6,15 +7,13 @@ export declare function splitForLocales(path: string, locales: string[]): [strin
|
|
|
6
7
|
* Transform a literal notation string regex to RegExp
|
|
7
8
|
*/
|
|
8
9
|
export declare function normalizeRuntimeFilters(input?: FilterInput[]): (RegExp | string)[];
|
|
9
|
-
export
|
|
10
|
+
export declare function createPathFilter(options?: {
|
|
10
11
|
include?: (FilterInput | string | RegExp)[];
|
|
11
12
|
exclude?: (FilterInput | string | RegExp)[];
|
|
12
|
-
}
|
|
13
|
-
export declare function createPathFilter(options?: CreateFilterOptions): (loc: string) => boolean;
|
|
13
|
+
}, baseURL?: string): (loc: string) => boolean;
|
|
14
14
|
export interface PageMatch {
|
|
15
15
|
mappings: Record<string, string | false>;
|
|
16
16
|
paramSegments: string[];
|
|
17
17
|
}
|
|
18
18
|
export declare function findPageMapping(pathWithoutPrefix: string, pages: Record<string, Record<string, string | false>>): PageMatch | null;
|
|
19
19
|
export declare function applyDynamicParams(customPath: string, paramSegments: string[]): string;
|
|
20
|
-
export declare function createFilter(options?: CreateFilterOptions): (path: string) => boolean;
|