@nuxtjs/sitemap 7.5.2 → 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 +62 -39
- package/dist/content.d.ts +62 -39
- package/dist/content.mjs +68 -38
- 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 +398 -432
- 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.d.ts +2 -2
- package/dist/runtime/server/routes/__sitemap__/debug.js +23 -4
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v2.js +1 -1
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.d.ts +1 -3
- package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +24 -12
- package/dist/runtime/server/routes/sitemap.xsl.js +349 -153
- 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 +24 -7
- package/dist/runtime/server/sitemap/builder/xml.js +55 -25
- package/dist/runtime/server/sitemap/event-handlers.js +15 -6
- package/dist/runtime/server/sitemap/nitro.js +17 -8
- package/dist/runtime/server/sitemap/urlset/normalise.d.ts +2 -1
- package/dist/runtime/server/sitemap/urlset/normalise.js +25 -1
- package/dist/runtime/server/sitemap/urlset/sources.js +3 -3
- package/dist/runtime/types.d.ts +14 -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 +21 -10
- package/dist/utils.d.ts +21 -10
- package/dist/utils.mjs +62 -8
- package/package.json +49 -49
- package/dist/client/200.html +0 -1
- package/dist/client/404.html +0 -1
- package/dist/client/__sitemap__/style.xsl +0 -190
- package/dist/client/_nuxt/CVDC-Ayb.js +0 -155
- package/dist/client/_nuxt/CVO1_9PV.js +0 -1
- package/dist/client/_nuxt/Cp-IABpG.js +0 -1
- package/dist/client/_nuxt/D0r3Knsf.js +0 -1
- package/dist/client/_nuxt/builds/latest.json +0 -1
- package/dist/client/_nuxt/builds/meta/1e2c692d-9f57-4b49-a518-f0dad9ea1e8b.json +0 -1
- package/dist/client/_nuxt/byQmnvHb.js +0 -1
- package/dist/client/_nuxt/cP7UVfHI.js +0 -1
- package/dist/client/_nuxt/entry.Ci1pP-eR.css +0 -1
- package/dist/client/_nuxt/error-404.DHoMe5Vi.css +0 -1
- package/dist/client/_nuxt/error-500.Da7n0rc6.css +0 -1
- package/dist/client/index.html +0 -1
- package/dist/client/sitemap.xml +0 -7
- package/virtual.d.ts +0 -15
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import type { SitemapDefinition } from '../../../types.js';
|
|
1
|
+
import type { SitemapDefinition, SitemapSourceResolved } from '../../../types.js';
|
|
2
2
|
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
|
|
3
3
|
nitroOrigin: string;
|
|
4
4
|
sitemaps: Record<string, SitemapDefinition>;
|
|
@@ -35,7 +35,7 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
|
|
|
35
35
|
credits: boolean;
|
|
36
36
|
minify: boolean;
|
|
37
37
|
};
|
|
38
|
-
globalSources:
|
|
38
|
+
globalSources: SitemapSourceResolved[];
|
|
39
39
|
siteConfig: {
|
|
40
40
|
[x: string]: any;
|
|
41
41
|
[x: number]: any;
|
|
@@ -1,11 +1,30 @@
|
|
|
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 { useSitemapRuntimeConfig } from "../../utils.js";
|
|
10
|
+
function attachUrlWarnings(sources) {
|
|
11
|
+
for (const source of sources) {
|
|
12
|
+
if (!source.urls?.length)
|
|
13
|
+
continue;
|
|
14
|
+
const warnings = [];
|
|
15
|
+
for (const url of source.urls) {
|
|
16
|
+
const msgs = validateSitemapUrl(url);
|
|
17
|
+
if (msgs.length) {
|
|
18
|
+
const loc = typeof url === "string" ? url : url.loc || "";
|
|
19
|
+
for (const message of msgs)
|
|
20
|
+
warnings.push({ loc, message });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (warnings.length)
|
|
24
|
+
source._urlWarnings = warnings;
|
|
25
|
+
}
|
|
26
|
+
return sources;
|
|
27
|
+
}
|
|
9
28
|
export default defineEventHandler(async (e) => {
|
|
10
29
|
const _runtimeConfig = useSitemapRuntimeConfig();
|
|
11
30
|
const siteConfig = getSiteConfig(e);
|
|
@@ -19,14 +38,14 @@ export default defineEventHandler(async (e) => {
|
|
|
19
38
|
const sitemap = _sitemaps[s];
|
|
20
39
|
sitemaps[s] = {
|
|
21
40
|
...sitemap,
|
|
22
|
-
sources: await resolveSitemapSources(await childSitemapSources(sitemap), e)
|
|
41
|
+
sources: attachUrlWarnings(await resolveSitemapSources(await childSitemapSources(sitemap), e))
|
|
23
42
|
};
|
|
24
43
|
}
|
|
25
44
|
return {
|
|
26
45
|
nitroOrigin,
|
|
27
46
|
sitemaps,
|
|
28
47
|
runtimeConfig,
|
|
29
|
-
globalSources: await resolveSitemapSources(globalSources, e),
|
|
48
|
+
globalSources: attachUrlWarnings(await resolveSitemapSources(globalSources, e)),
|
|
30
49
|
siteConfig: { ...siteConfig }
|
|
31
50
|
};
|
|
32
51
|
});
|
|
@@ -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,4 +1,2 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<
|
|
2
|
-
loc: string | undefined;
|
|
3
|
-
}[]>>;
|
|
1
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<Record<string, unknown>[]>>;
|
|
4
2
|
export default _default;
|
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
2
|
-
import { queryCollection } from "@nuxt/content/server";
|
|
3
1
|
import manifest from "#content/manifest";
|
|
2
|
+
import { filters } from "#sitemap/content-filters";
|
|
3
|
+
import { onUrlFns } from "#sitemap/content-on-url";
|
|
4
|
+
import { queryCollection } from "@nuxt/content/server";
|
|
5
|
+
import { defineEventHandler } from "h3";
|
|
4
6
|
export default defineEventHandler(async (e) => {
|
|
5
7
|
const collections = [];
|
|
6
8
|
for (const collection in manifest) {
|
|
7
|
-
if (manifest[collection].fields.sitemap)
|
|
9
|
+
if (manifest[collection].fields.sitemap)
|
|
8
10
|
collections.push(collection);
|
|
9
|
-
}
|
|
10
11
|
}
|
|
11
12
|
const contentList = [];
|
|
12
13
|
for (const collection of collections) {
|
|
14
|
+
const needsAllFields = filters?.has(collection) || onUrlFns?.has(collection);
|
|
15
|
+
const query = queryCollection(e, collection).where("path", "IS NOT NULL").where("sitemap", "IS NOT NULL");
|
|
16
|
+
if (!needsAllFields)
|
|
17
|
+
query.select("path", "sitemap");
|
|
13
18
|
contentList.push(
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
query.all().then((results2) => {
|
|
20
|
+
const filter = filters?.get(collection);
|
|
21
|
+
return { collection, entries: filter ? results2.filter(filter) : results2 };
|
|
22
|
+
})
|
|
16
23
|
);
|
|
17
24
|
}
|
|
18
25
|
const results = await Promise.all(contentList);
|
|
19
|
-
return results.flatMap(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
return results.flatMap(({ collection, entries }) => {
|
|
27
|
+
const onUrl = onUrlFns?.get(collection);
|
|
28
|
+
return entries.filter((c) => c.sitemap !== false && c.path && !c.path.endsWith(".navigation")).map((c) => {
|
|
29
|
+
const url = {
|
|
30
|
+
loc: c.path,
|
|
31
|
+
...typeof c.sitemap === "object" ? c.sitemap : {}
|
|
32
|
+
};
|
|
33
|
+
onUrl?.(url, c, collection);
|
|
34
|
+
return url;
|
|
35
|
+
});
|
|
36
|
+
}).filter(Boolean);
|
|
25
37
|
});
|