@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.
Files changed (108) hide show
  1. package/README.md +8 -2
  2. package/dist/content.d.mts +62 -39
  3. package/dist/content.d.ts +62 -39
  4. package/dist/content.mjs +68 -38
  5. package/dist/devtools/200.html +1 -0
  6. package/dist/devtools/404.html +1 -0
  7. package/dist/devtools/_fonts/4ppnHhMi-pBsWSPo7mY0avYxlDoAg1N3PTzCwXLZ5rA-d9oibkGnTd1JL3tc_xnaVgBLYmOB8kjrK2cvZaqwj9s.woff2 +0 -0
  8. package/dist/devtools/_fonts/4qBuU9MRVUlPZNPSF7Xom_sK8RBEnfYu-9VXFrdq8A8-8TDwLE1HAj1sQn7XxVWtM_7sIaPM-DTdO3Pf8U2DF1U.woff2 +0 -0
  9. package/dist/devtools/_fonts/6dYsbWUd_BpKJ7mdDihgOcya1gHXLpJBuMYXux3WMjE-q3fYNS8YbW5n7ZeXI2vSNgkRWW5VDPKAl51SNTjG2qk.woff2 +0 -0
  10. package/dist/devtools/_fonts/Lr-hqqZZsYmCt0ITUlr1CUrWim9fsKvoDFZliMxgNHY-iTa_Yt_PzhOY9TX7ZXdSlEPim6iRt92xhECwaxWxd5w.woff2 +0 -0
  11. package/dist/devtools/_fonts/OknHvWI6KtYn1JQBzX7eSpNDBQ8520F9TvSUJYkVf6A-xeZn9253svK_8Q2LD0XEruY_MnEsuCRO5LenPoggC0Y.woff2 +0 -0
  12. package/dist/devtools/_fonts/PV2hrQG6wq5BlIPDjdL1IcOflycaghyt5MHzlBqZtlo-lb_WexLz3VZqfTN0oi554iBH5tT2j2UFEV-XErCAS3E.woff2 +0 -0
  13. package/dist/devtools/_fonts/UA7OtwYHwGN_HjcVGTdmiQxUit7FlqkCwxVUWSeXVnQ-B4OXCFOL_tWrYODpQTc07aMaj0c2cewTOmBRWR9tD-A.woff2 +0 -0
  14. package/dist/devtools/_fonts/VE4cDVCv5MxbFM7ZLoLCGbIpNd71zhp7MDI9lmN5Y7I-xZyDYCUVrd6LV8eVGF3Um3UZjBFuUtDGtvdyTBBRYBo.woff2 +0 -0
  15. package/dist/devtools/_fonts/fVoGbnMbBFd5L9BBp9fUPavUSkZ_EmsQNSyadkT-108-U4T0khaeLQSIhtt9eVvaCEKJjtWJ4ioRJOf8hvqkWY0.woff2 +0 -0
  16. package/dist/devtools/_fonts/lQAxeCEs1R0Lw-H9XRU1RlOARQN8J6npRsPjyEDMe5s-_DUSLEkO3tKTuun_gSnDLoQPVEnpOnyqZMOw0ByZ6PA.woff2 +0 -0
  17. package/dist/devtools/_fonts/lntlqNHKLV2n82yTwMde70QqOjcfLE2XJ5oKZ3vRPWc-z6TxpIZQdWXztWLr9_OFWqt_WJJoeGtuK_-XQMZGQwE.woff2 +0 -0
  18. package/dist/devtools/_fonts/qxAYvKsXWeYv731eb-h5TRurcdIP_W44mpNdX-HABAk-zUDeMEFlNtNbrwvT9JxLEBg0TphGy70O6RfIoIX_ZwU.woff2 +0 -0
  19. package/dist/devtools/_nuxt/6-8YL5RT.js +1 -0
  20. package/dist/devtools/_nuxt/B-CoxLn7.js +1 -0
  21. package/dist/devtools/_nuxt/BBg_LgdD.js +1 -0
  22. package/dist/devtools/_nuxt/BFP26XjE.js +1 -0
  23. package/dist/devtools/_nuxt/BFxFqELk.js +1 -0
  24. package/dist/devtools/_nuxt/BJ46vUgN.js +22 -0
  25. package/dist/devtools/_nuxt/BK43-3Xm.js +1 -0
  26. package/dist/devtools/_nuxt/BUgp7PK5.js +1 -0
  27. package/dist/devtools/_nuxt/BUwCbG2W.js +1 -0
  28. package/dist/devtools/_nuxt/BgUkVPML.js +1 -0
  29. package/dist/devtools/_nuxt/Bl-ESRhh.js +1 -0
  30. package/dist/devtools/_nuxt/BpntLhpu.js +1 -0
  31. package/dist/devtools/_nuxt/CMkTWvG2.js +1 -0
  32. package/dist/devtools/_nuxt/CdSSkj0j.js +6 -0
  33. package/dist/devtools/_nuxt/Cfg7NvvP.js +3 -0
  34. package/dist/devtools/_nuxt/Cq2IBCZt.js +1 -0
  35. package/dist/devtools/_nuxt/D56-uEuD.js +1 -0
  36. package/dist/devtools/_nuxt/D9eL2h5z.js +1 -0
  37. package/dist/devtools/_nuxt/DC83McAa.js +154 -0
  38. package/dist/devtools/_nuxt/DLfyhkbV.js +1 -0
  39. package/dist/devtools/_nuxt/DRdBN13f.js +1 -0
  40. package/dist/devtools/_nuxt/DevtoolsEmptyState.CPam6VsX.css +1 -0
  41. package/dist/devtools/_nuxt/DevtoolsSection.BeqVO-za.css +1 -0
  42. package/dist/devtools/_nuxt/DuYBAn1h.js +1 -0
  43. package/dist/devtools/_nuxt/Source.ChvNXxeG.css +1 -0
  44. package/dist/devtools/_nuxt/_hKGTbzI.js +1 -0
  45. package/dist/devtools/_nuxt/builds/latest.json +1 -0
  46. package/dist/devtools/_nuxt/builds/meta/8c443858-dba7-4dd0-b65e-6a31b3bbefed.json +1 -0
  47. package/dist/devtools/_nuxt/entry.DuwzcCXL.css +2 -0
  48. package/dist/devtools/_nuxt/error-404.CbnweSUu.css +1 -0
  49. package/dist/devtools/_nuxt/error-500.DrNDBqZi.css +1 -0
  50. package/dist/devtools/_nuxt/jxhrXVY1.js +1 -0
  51. package/dist/devtools/_nuxt/pages.CV7xHNff.css +1 -0
  52. package/dist/devtools/app-sources/index.html +1 -0
  53. package/dist/devtools/debug/index.html +1 -0
  54. package/dist/devtools/docs/index.html +1 -0
  55. package/dist/devtools/index.html +1 -0
  56. package/dist/devtools/user-sources/index.html +1 -0
  57. package/dist/module.d.mts +10 -1
  58. package/dist/module.d.ts +10 -1
  59. package/dist/module.json +1 -1
  60. package/dist/module.mjs +398 -432
  61. package/dist/runtime/server/composables/defineSitemapEventHandler.d.ts +1 -1
  62. package/dist/runtime/server/kit.d.ts +0 -1
  63. package/dist/runtime/server/kit.js +5 -7
  64. package/dist/runtime/server/plugins/warm-up.js +1 -1
  65. package/dist/runtime/server/robots-polyfill/getPathRobotConfig.d.ts +1 -1
  66. package/dist/runtime/server/robots-polyfill/getPathRobotConfig.js +1 -1
  67. package/dist/runtime/server/routes/__sitemap__/debug-production.d.ts +17 -0
  68. package/dist/runtime/server/routes/__sitemap__/debug-production.js +77 -0
  69. package/dist/runtime/server/routes/__sitemap__/debug.d.ts +2 -2
  70. package/dist/runtime/server/routes/__sitemap__/debug.js +23 -4
  71. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v2.js +1 -1
  72. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.d.ts +1 -3
  73. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +24 -12
  74. package/dist/runtime/server/routes/sitemap.xsl.js +349 -153
  75. package/dist/runtime/server/sitemap/builder/sitemap-index.js +8 -7
  76. package/dist/runtime/server/sitemap/builder/sitemap.d.ts +1 -1
  77. package/dist/runtime/server/sitemap/builder/sitemap.js +24 -7
  78. package/dist/runtime/server/sitemap/builder/xml.js +55 -25
  79. package/dist/runtime/server/sitemap/event-handlers.js +15 -6
  80. package/dist/runtime/server/sitemap/nitro.js +17 -8
  81. package/dist/runtime/server/sitemap/urlset/normalise.d.ts +2 -1
  82. package/dist/runtime/server/sitemap/urlset/normalise.js +25 -1
  83. package/dist/runtime/server/sitemap/urlset/sources.js +3 -3
  84. package/dist/runtime/types.d.ts +14 -8
  85. package/dist/runtime/utils-pure.d.ts +3 -4
  86. package/dist/runtime/utils-pure.js +13 -41
  87. package/dist/shared/{sitemap.Bj0OAEtK.mjs → sitemap.B99ug6A9.mjs} +9 -5
  88. package/dist/utils.d.mts +21 -10
  89. package/dist/utils.d.ts +21 -10
  90. package/dist/utils.mjs +62 -8
  91. package/package.json +49 -49
  92. package/dist/client/200.html +0 -1
  93. package/dist/client/404.html +0 -1
  94. package/dist/client/__sitemap__/style.xsl +0 -190
  95. package/dist/client/_nuxt/CVDC-Ayb.js +0 -155
  96. package/dist/client/_nuxt/CVO1_9PV.js +0 -1
  97. package/dist/client/_nuxt/Cp-IABpG.js +0 -1
  98. package/dist/client/_nuxt/D0r3Knsf.js +0 -1
  99. package/dist/client/_nuxt/builds/latest.json +0 -1
  100. package/dist/client/_nuxt/builds/meta/1e2c692d-9f57-4b49-a518-f0dad9ea1e8b.json +0 -1
  101. package/dist/client/_nuxt/byQmnvHb.js +0 -1
  102. package/dist/client/_nuxt/cP7UVfHI.js +0 -1
  103. package/dist/client/_nuxt/entry.Ci1pP-eR.css +0 -1
  104. package/dist/client/_nuxt/error-404.DHoMe5Vi.css +0 -1
  105. package/dist/client/_nuxt/error-500.Da7n0rc6.css +0 -1
  106. package/dist/client/index.html +0 -1
  107. package/dist/client/sitemap.xml +0 -7
  108. package/virtual.d.ts +0 -15
@@ -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 { applyDynamicParams, createPathFilter, findPageMapping, splitForLocales } from "../../../utils-pure.js";
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,14 +221,30 @@ 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);
225
+ if (isMultiSitemap) {
226
+ const sitemapNames = Object.keys(sitemaps).filter((k) => k !== "index");
227
+ const warnedSitemaps = nitro?._sitemapWarnedSitemaps || /* @__PURE__ */ new Set();
228
+ for (const e of enhancedUrls) {
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) {
231
+ if (!warnedSitemaps.has(e._sitemap)) {
232
+ warnedSitemaps.add(e._sitemap);
233
+ logger.error(`Sitemap \`${e._sitemap}\` not found in sitemap config. Available sitemaps: ${sitemapNames.join(", ")}. Entry \`${e.loc}\` will be omitted.`);
234
+ }
235
+ }
236
+ }
237
+ if (nitro) {
238
+ nitro._sitemapWarnedSitemaps = warnedSitemaps;
239
+ }
240
+ }
224
241
  const filteredUrls = enhancedUrls.filter((e) => {
225
242
  if (e._sitemap === false)
226
243
  return false;
227
244
  if (isMultiSitemap && e._sitemap && sitemap.sitemapName) {
228
245
  if (sitemap._isChunking)
229
- return sitemap.sitemapName.startsWith(e._sitemap + "-");
230
- 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}-`);
231
248
  }
232
249
  return true;
233
250
  });
@@ -5,13 +5,18 @@ export function escapeValueForXml(value) {
5
5
  return value ? "yes" : "no";
6
6
  return xmlEscape(String(value));
7
7
  }
8
- const yesNo = (v) => v === "yes" || v === true ? "yes" : "no";
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) xml += `${I2}<loc>${xmlEscape(url.loc)}</loc>${NL}`;
13
- if (url.lastmod) xml += `${I2}<lastmod>${url.lastmod}</lastmod>${NL}`;
14
- if (url.changefreq) xml += `${I2}<changefreq>${url.changefreq}</changefreq>${NL}`;
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) xml += `${I3}<image:title>${xmlEscape(img.title)}</image:title>${NL}`;
30
- if (img.caption) xml += `${I3}<image:caption>${xmlEscape(img.caption)}</image:caption>${NL}`;
31
- if (img.geo_location) xml += `${I3}<image:geo_location>${xmlEscape(img.geo_location)}</image:geo_location>${NL}`;
32
- if (img.license) xml += `${I3}<image:license>${xmlEscape(img.license)}</image:license>${NL}`;
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) xml += `${I3}<video:thumbnail_loc>${xmlEscape(video.thumbnail_loc)}</video:thumbnail_loc>${NL}`;
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) xml += `${I3}<video:content_loc>${xmlEscape(video.content_loc)}</video:content_loc>${NL}`;
42
- if (video.player_loc) xml += `${I3}<video:player_loc>${xmlEscape(video.player_loc)}</video:player_loc>${NL}`;
43
- if (video.duration !== void 0) xml += `${I3}<video:duration>${video.duration}</video:duration>${NL}`;
44
- if (video.expiration_date) xml += `${I3}<video:expiration_date>${video.expiration_date}</video:expiration_date>${NL}`;
45
- if (video.rating !== void 0) xml += `${I3}<video:rating>${video.rating}</video:rating>${NL}`;
46
- if (video.view_count !== void 0) xml += `${I3}<video:view_count>${video.view_count}</video:view_count>${NL}`;
47
- if (video.publication_date) xml += `${I3}<video:publication_date>${video.publication_date}</video:publication_date>${NL}`;
48
- if (video.family_friendly !== void 0) xml += `${I3}<video:family_friendly>${yesNo(video.family_friendly)}</video:family_friendly>${NL}`;
49
- if (video.restriction) xml += `${I3}<video:restriction relationship="${video.restriction.relationship || "allow"}">${xmlEscape(video.restriction.restriction)}</video:restriction>${NL}`;
50
- if (video.platform) xml += `${I3}<video:platform relationship="${video.platform.relationship || "allow"}">${xmlEscape(video.platform.platform)}</video:platform>${NL}`;
51
- if (video.requires_subscription !== void 0) xml += `${I3}<video:requires_subscription>${yesNo(video.requires_subscription)}</video:requires_subscription>${NL}`;
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) xml += `${I3}<video:live>${yesNo(video.live)}</video:live>${NL}`;
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) xml += `${I3}<video:category>${xmlEscape(video.category)}</video:category>${NL}`;
69
- if (video.gallery_loc) xml += `${I3}<video:gallery_loc>${xmlEscape(video.gallery_loc)}</video:gallery_loc>${NL}`;
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,10 +99,16 @@ 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) xml += `${I3}<news:title>${xmlEscape(url.news.title)}</news:title>${NL}`;
79
- if (url.news.publication_date) xml += `${I3}<news:publication_date>${url.news.publication_date}</news:publication_date>${NL}`;
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
  }
108
+ if (import.meta.dev && url._warnings?.length) {
109
+ for (const w of url._warnings)
110
+ xml += `${I2}<!-- WARN: ${w} -->${NL}`;
111
+ }
82
112
  xml += `${I1}</url>`;
83
113
  return xml;
84
114
  }
@@ -1,10 +1,10 @@
1
1
  import { appendHeader, createError, getRouterParam, sendRedirect, setHeader } from "h3";
2
- import { joinURL, withBase, withoutLeadingSlash, withoutTrailingSlash } from "ufo";
3
- import { useRuntimeConfig, useNitroApp } from "nitropack/runtime";
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 { parseChunkInfo, getSitemapConfig } from "./utils/chunk.js";
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;
@@ -53,13 +53,22 @@ export async function sitemapChildXmlEventHandler(e) {
53
53
  let sitemapName = getRouterParam(e, "sitemap");
54
54
  if (!sitemapName) {
55
55
  const path = e.path;
56
- const match = path.match(/(?:\/__sitemap__\/)?([^/]+)\.xml$/);
56
+ const match = path.match(/(?:\/__sitemap__\/)?(.+)\.xml$/);
57
57
  if (match)
58
58
  sitemapName = match[1];
59
59
  }
60
60
  if (!sitemapName)
61
61
  throw createError({ statusCode: 400, message: "Invalid sitemap request" });
62
- sitemapName = withoutLeadingSlash(withoutTrailingSlash(sitemapName.replace(".xml", "").replace("__sitemap__/", "").replace(runtimeConfig.sitemapsPathPrefix || "", "")));
62
+ sitemapName = sitemapName.replace(/\.xml$/, "");
63
+ sitemapName = withLeadingSlash(sitemapName);
64
+ if (sitemapName.startsWith("/__sitemap__/"))
65
+ sitemapName = sitemapName.replace("/__sitemap__/", "/");
66
+ if (runtimeConfig.sitemapsPathPrefix) {
67
+ const prefix = withLeadingSlash(runtimeConfig.sitemapsPathPrefix);
68
+ if (sitemapName.startsWith(prefix))
69
+ sitemapName = sitemapName.replace(prefix, "/");
70
+ }
71
+ sitemapName = withoutLeadingSlash(withoutTrailingSlash(sitemapName));
63
72
  const chunkInfo = parseChunkInfo(sitemapName, sitemaps, runtimeConfig.defaultSitemapsChunkSize);
64
73
  const isAutoChunked = typeof sitemaps.chunks !== "undefined" && !Number.isNaN(Number(sitemapName));
65
74
  const sitemapExists = sitemapName in sitemaps || chunkInfo.baseSitemapName in sitemaps || isAutoChunked;
@@ -1,19 +1,19 @@
1
- import { getQuery, setHeader, createError, getHeader } from "h3";
2
- import { fixSlashes } from "nuxt-site-config/urls";
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 { useNitroApp, defineCachedFunction } from "nitropack/runtime";
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 { useSiteConfig } from "#site-config/server/composables/useSiteConfig";
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";
16
- const siteConfig = useSiteConfig(e);
16
+ const siteConfig = getSiteConfig(e);
17
17
  return {
18
18
  event: e,
19
19
  fixSlashes: (path) => fixSlashes(siteConfig.trailingSlash, path),
@@ -30,7 +30,7 @@ async function buildSitemapXml(event, definition, resolvers, runtimeConfig) {
30
30
  const { sitemapName } = definition;
31
31
  const nitro = useNitroApp();
32
32
  if (import.meta.prerender) {
33
- const config = useSiteConfig(event);
33
+ const config = getSiteConfig(event);
34
34
  if (!config.url && !nitro._sitemapWarned) {
35
35
  nitro._sitemapWarned = true;
36
36
  logger.error("Sitemap Site URL missing!");
@@ -42,6 +42,12 @@ async function buildSitemapXml(event, definition, resolvers, runtimeConfig) {
42
42
  }
43
43
  }
44
44
  const { urls: sitemapUrls, failedSources } = await buildSitemapUrls(definition, resolvers, runtimeConfig, nitro);
45
+ if (import.meta.prerender && failedSources.length) {
46
+ throw createError({
47
+ statusCode: 500,
48
+ message: `Sitemap generation failed due to ${failedSources.length} failed sources: ${failedSources.map((s) => `"${s.url}" (${s.error})`).join(", ")}`
49
+ });
50
+ }
45
51
  const routeRuleMatcher = createNitroRouteRuleMatcher();
46
52
  const { autoI18n } = runtimeConfig;
47
53
  let validCount = 0;
@@ -67,6 +73,9 @@ async function buildSitemapXml(event, definition, resolvers, runtimeConfig) {
67
73
  sitemapUrls[validCount++] = routeRules.sitemap ? defu(u, routeRules.sitemap) : u;
68
74
  }
69
75
  sitemapUrls.length = validCount;
76
+ if (import.meta.dev && validCount === 0 && sitemapUrls.length > 0) {
77
+ logger.warn(`Sitemap had ${sitemapUrls.length} that were all filtered out. This may be due to a robots rules blocking these URLs from indexing. Check your /** route rules or robots.txt configuration.`);
78
+ }
70
79
  const locSize = sitemapUrls.length;
71
80
  const resolvedCtx = {
72
81
  urls: sitemapUrls,
@@ -1,4 +1,5 @@
1
- import type { NitroUrlResolvers, ResolvedSitemapUrl, SitemapUrl } from '../../../types.js';
1
+ import type { NitroUrlResolvers, ResolvedSitemapUrl, SitemapUrl, SitemapUrlInput } from '../../../types.js';
2
+ export declare function validateSitemapUrl(url: SitemapUrlInput): string[];
2
3
  export declare function preNormalizeEntry(_e: SitemapUrl | string, resolvers?: NitroUrlResolvers): ResolvedSitemapUrl;
3
4
  export declare function isEncoded(url: string): boolean;
4
5
  export declare function normaliseEntry(_e: ResolvedSitemapUrl, defaults: Omit<SitemapUrl, 'loc'>, resolvers?: NitroUrlResolvers): ResolvedSitemapUrl;
@@ -1,3 +1,4 @@
1
+ import { defu } from "defu";
1
2
  import {
2
3
  encodePath,
3
4
  hasProtocol,
@@ -8,8 +9,26 @@ 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
+ const VALID_CHANGEFREQ = ["always", "hourly", "daily", "weekly", "monthly", "yearly", "never"];
14
+ export function validateSitemapUrl(url) {
15
+ if (typeof url === "string")
16
+ return [];
17
+ const warnings = [];
18
+ if (url.lastmod) {
19
+ const d = typeof url.lastmod === "string" ? url.lastmod : void 0;
20
+ if (d && !isValidW3CDate(d))
21
+ warnings.push(`lastmod "${d}" is not a valid W3C date`);
22
+ }
23
+ if (url.changefreq && !VALID_CHANGEFREQ.includes(url.changefreq))
24
+ warnings.push(`changefreq "${url.changefreq}" is not valid (expected: always|hourly|daily|weekly|monthly|yearly|never)`);
25
+ if (url.priority !== void 0) {
26
+ const p = typeof url.priority === "number" ? url.priority : Number.parseFloat(String(url.priority));
27
+ if (Number.isNaN(p) || p < 0 || p > 1)
28
+ warnings.push(`priority "${url.priority}" is not valid (expected: number between 0.0 and 1.0)`);
29
+ }
30
+ return warnings;
31
+ }
13
32
  function resolve(s, resolvers) {
14
33
  if (typeof s === "undefined")
15
34
  return void 0;
@@ -69,6 +88,11 @@ export function isEncoded(url) {
69
88
  }
70
89
  export function normaliseEntry(_e, defaults, resolvers) {
71
90
  const e = defu(_e, defaults);
91
+ if (import.meta.dev) {
92
+ const warnings = validateSitemapUrl(e);
93
+ if (warnings.length)
94
+ e._warnings = (e._warnings || []).concat(warnings);
95
+ }
72
96
  if (e.lastmod) {
73
97
  const date = normaliseDate(e.lastmod);
74
98
  if (date)
@@ -1,8 +1,8 @@
1
- import { getRequestHost } from "h3";
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 };
@@ -54,7 +54,7 @@ export async function fetchDataSource(input, event) {
54
54
  {
55
55
  Accept: isXmlRequest ? "text/xml" : "application/json"
56
56
  },
57
- event ? { host: getRequestHost(event, { xForwardedHost: true }) } : {}
57
+ event && !isExternalUrl ? { host: getRequestHost(event, { xForwardedHost: true }) } : {}
58
58
  );
59
59
  const fetchOptions = {
60
60
  ...options,
@@ -1,7 +1,7 @@
1
- import type { FetchOptions } from 'ofetch';
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.
@@ -188,6 +188,10 @@ export interface SitemapSourceResolved extends Omit<SitemapSourceBase, 'urls'> {
188
188
  error?: any;
189
189
  timeTakenMs?: number;
190
190
  _isFailure?: boolean;
191
+ _urlWarnings?: {
192
+ loc: string;
193
+ message: string;
194
+ }[];
191
195
  }
192
196
  export type AppSourceContext = 'nuxt:pages' | 'nuxt:prerender' | 'nuxt:route-rules' | '@nuxtjs/i18n:pages' | '@nuxt/content:document-driven';
193
197
  export type SitemapSourceInput = string | [string, FetchOptions] | SitemapSourceBase | SitemapSourceResolved;
@@ -202,10 +206,10 @@ interface LocaleObject extends Record<string, any> {
202
206
  path: string;
203
207
  cache?: boolean;
204
208
  };
205
- files?: string[] | {
209
+ files?: (string | {
206
210
  path: string;
207
211
  cache?: boolean;
208
- }[];
212
+ })[];
209
213
  isCatchallLocale?: boolean;
210
214
  /**
211
215
  * @deprecated in v9, use `language` instead
@@ -265,6 +269,10 @@ export type ResolvedSitemapUrl = Omit<SitemapUrl, 'url'> & Required<Pick<Sitemap
265
269
  * @internal
266
270
  */
267
271
  _abs: boolean;
272
+ /**
273
+ * @internal
274
+ */
275
+ _warnings?: string[];
268
276
  };
269
277
  export interface SitemapDefinition {
270
278
  /**
@@ -400,6 +408,7 @@ export interface SitemapUrl {
400
408
  */
401
409
  _encoded?: boolean;
402
410
  }
411
+ export type SitemapItemDefaults = Omit<SitemapUrl, 'loc'>;
403
412
  export type SitemapStrict = Required<SitemapUrl>;
404
413
  export interface AlternativeEntry {
405
414
  hreflang: string;
@@ -481,8 +490,5 @@ export interface NitroUrlResolvers {
481
490
  relativeBaseUrlResolver: (path: string) => string;
482
491
  fixSlashes: (path: string) => string;
483
492
  }
484
- interface NuxtI18nMicro {
485
- includeDefaultLocaleRoute?: boolean;
486
- }
487
- export type I18nIntegrationOptions = NuxtI18nOptions & NuxtI18nMicro;
493
+ export type I18nIntegrationOptions = NuxtI18nOptions;
488
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 interface CreateFilterOptions {
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;
@@ -1,7 +1,8 @@
1
- import { createDefu } from "defu";
2
- import { parseURL, withLeadingSlash } from "ufo";
3
- import { createRouter, toRouteMatcher } from "radix3";
4
1
  import { createConsola } from "consola";
2
+ import { createDefu } from "defu";
3
+ import { createFilter } from "nuxtseo-shared/utils";
4
+ import { parseURL, withLeadingSlash, withoutBase } from "ufo";
5
+ export { createFilter } from "nuxtseo-shared/utils";
5
6
  export const logger = createConsola({
6
7
  defaults: {
7
8
  tag: "@nuxt/sitemap"
@@ -46,8 +47,12 @@ export function normalizeRuntimeFilters(input) {
46
47
  return false;
47
48
  }).filter(Boolean);
48
49
  }
49
- export function createPathFilter(options = {}) {
50
- const urlFilter = createFilter(options);
50
+ export function createPathFilter(options = {}, baseURL) {
51
+ const urlFilter = createFilter({
52
+ include: normalizeRuntimeFilters(options.include),
53
+ exclude: normalizeRuntimeFilters(options.exclude)
54
+ });
55
+ const hasBase = baseURL && baseURL !== "/";
51
56
  return (loc) => {
52
57
  let path = loc;
53
58
  try {
@@ -55,6 +60,8 @@ export function createPathFilter(options = {}) {
55
60
  } catch {
56
61
  return false;
57
62
  }
63
+ if (hasBase)
64
+ path = withoutBase(path, baseURL);
58
65
  return urlFilter(path);
59
66
  };
60
67
  }
@@ -65,7 +72,7 @@ export function findPageMapping(pathWithoutPrefix, pages) {
65
72
  return { mappings: pages[pageKey], paramSegments: [] };
66
73
  const sortedKeys = Object.keys(pages).sort((a, b) => b.length - a.length);
67
74
  for (const key of sortedKeys) {
68
- if (pageKey.startsWith(key + "/")) {
75
+ if (pageKey.startsWith(`${key}/`)) {
69
76
  const paramPath = pageKey.slice(key.length + 1);
70
77
  return { mappings: pages[key], paramSegments: paramPath.split("/") };
71
78
  }
@@ -78,38 +85,3 @@ export function applyDynamicParams(customPath, paramSegments) {
78
85
  let i = 0;
79
86
  return customPath.replace(/\[[^\]]+\]/g, () => paramSegments[i++] || "");
80
87
  }
81
- export function createFilter(options = {}) {
82
- const include = options.include || [];
83
- const exclude = options.exclude || [];
84
- if (include.length === 0 && exclude.length === 0)
85
- return () => true;
86
- const excludeRegex = exclude.filter((r) => r instanceof RegExp);
87
- const includeRegex = include.filter((r) => r instanceof RegExp);
88
- const excludeStrings = exclude.filter((r) => typeof r === "string");
89
- const includeStrings = include.filter((r) => typeof r === "string");
90
- const excludeMatcher = excludeStrings.length > 0 ? toRouteMatcher(createRouter({
91
- routes: Object.fromEntries(excludeStrings.map((r) => [r, true])),
92
- strictTrailingSlash: false
93
- })) : null;
94
- const includeMatcher = includeStrings.length > 0 ? toRouteMatcher(createRouter({
95
- routes: Object.fromEntries(includeStrings.map((r) => [r, true])),
96
- strictTrailingSlash: false
97
- })) : null;
98
- const excludeExact = new Set(excludeStrings);
99
- const includeExact = new Set(includeStrings);
100
- return function(path) {
101
- if (excludeRegex.some((r) => r.test(path)))
102
- return false;
103
- if (excludeExact.has(path))
104
- return false;
105
- if (excludeMatcher && excludeMatcher.matchAll(path).length > 0)
106
- return false;
107
- if (includeRegex.some((r) => r.test(path)))
108
- return true;
109
- if (includeExact.has(path))
110
- return true;
111
- if (includeMatcher && includeMatcher.matchAll(path).length > 0)
112
- return true;
113
- return include.length === 0;
114
- };
115
- }
@@ -2,9 +2,11 @@ import { parseURL } from 'ufo';
2
2
  import { parse, walkSync, ELEMENT_NODE } from 'ultrahtml';
3
3
 
4
4
  function isValidUrl(url) {
5
- if (!url || typeof url !== "string") return false;
5
+ if (!url || typeof url !== "string")
6
+ return false;
6
7
  const trimmed = url.trim();
7
- if (!trimmed) return false;
8
+ if (!trimmed)
9
+ return false;
8
10
  if (trimmed.startsWith("data:") || trimmed.startsWith("blob:") || trimmed.startsWith("file:")) {
9
11
  return false;
10
12
  }
@@ -19,11 +21,13 @@ function isValidString(value) {
19
21
  return typeof value === "string" && value.trim().length > 0;
20
22
  }
21
23
  function sanitizeString(value) {
22
- if (!isValidString(value)) return "";
24
+ if (!isValidString(value))
25
+ return "";
23
26
  return String(value).trim().replace(/[\x00-\x1F\x7F-\x9F]/g, "");
24
27
  }
25
28
  function isValidDate(dateString) {
26
- if (!dateString) return false;
29
+ if (!dateString)
30
+ return false;
27
31
  const date = new Date(dateString);
28
32
  return !Number.isNaN(date.getTime()) && date.getFullYear() > 1900 && date.getFullYear() < 3e3;
29
33
  }
@@ -180,7 +184,7 @@ function parseHtmlExtractSitemapMeta(html, options) {
180
184
  }
181
185
  });
182
186
  if (options?.images && images.size > 0) {
183
- payload.images = [...images].map((i) => ({ loc: i }));
187
+ payload.images = Array.from(images, (i) => ({ loc: i }));
184
188
  }
185
189
  if (options?.videos) {
186
190
  const processedVideos = [];
package/dist/utils.d.mts CHANGED
@@ -1,6 +1,14 @@
1
- import { SitemapUrlInput, SitemapUrl } from '../dist/runtime/types.js';
1
+ import { SitemapUrl, SitemapUrlInput } from '../dist/runtime/types.js';
2
2
  export * from '../dist/runtime/types.js';
3
3
 
4
+ declare function parseHtmlExtractSitemapMeta(html: string, options?: {
5
+ images?: boolean;
6
+ videos?: boolean;
7
+ lastmod?: boolean;
8
+ alternatives?: boolean;
9
+ resolveUrl?: (s: string) => string;
10
+ }): Partial<SitemapUrl> | null;
11
+
4
12
  interface SitemapWarning {
5
13
  type: 'validation';
6
14
  message: string;
@@ -16,13 +24,16 @@ interface SitemapParseResult {
16
24
  }
17
25
  declare function parseSitemapXml(xml: string): Promise<SitemapParseResult>;
18
26
 
19
- declare function parseHtmlExtractSitemapMeta(html: string, options?: {
20
- images?: boolean;
21
- videos?: boolean;
22
- lastmod?: boolean;
23
- alternatives?: boolean;
24
- resolveUrl?: (s: string) => string;
25
- }): Partial<SitemapUrl> | null;
27
+ interface SitemapIndexEntry {
28
+ loc: string;
29
+ lastmod?: string;
30
+ }
31
+ interface SitemapIndexParseResult {
32
+ entries: SitemapIndexEntry[];
33
+ warnings: SitemapWarning[];
34
+ }
35
+ declare function parseSitemapIndex(xml: string): SitemapIndexParseResult;
36
+ declare function isSitemapIndex(xml: string): boolean;
26
37
 
27
- export { parseHtmlExtractSitemapMeta, parseSitemapXml };
28
- export type { SitemapParseResult, SitemapWarning };
38
+ export { isSitemapIndex, parseHtmlExtractSitemapMeta, parseSitemapIndex, parseSitemapXml };
39
+ export type { SitemapIndexEntry, SitemapIndexParseResult, SitemapParseResult, SitemapWarning };
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,14 @@
1
- import { SitemapUrlInput, SitemapUrl } from '../dist/runtime/types.js';
1
+ import { SitemapUrl, SitemapUrlInput } from '../dist/runtime/types.js';
2
2
  export * from '../dist/runtime/types.js';
3
3
 
4
+ declare function parseHtmlExtractSitemapMeta(html: string, options?: {
5
+ images?: boolean;
6
+ videos?: boolean;
7
+ lastmod?: boolean;
8
+ alternatives?: boolean;
9
+ resolveUrl?: (s: string) => string;
10
+ }): Partial<SitemapUrl> | null;
11
+
4
12
  interface SitemapWarning {
5
13
  type: 'validation';
6
14
  message: string;
@@ -16,13 +24,16 @@ interface SitemapParseResult {
16
24
  }
17
25
  declare function parseSitemapXml(xml: string): Promise<SitemapParseResult>;
18
26
 
19
- declare function parseHtmlExtractSitemapMeta(html: string, options?: {
20
- images?: boolean;
21
- videos?: boolean;
22
- lastmod?: boolean;
23
- alternatives?: boolean;
24
- resolveUrl?: (s: string) => string;
25
- }): Partial<SitemapUrl> | null;
27
+ interface SitemapIndexEntry {
28
+ loc: string;
29
+ lastmod?: string;
30
+ }
31
+ interface SitemapIndexParseResult {
32
+ entries: SitemapIndexEntry[];
33
+ warnings: SitemapWarning[];
34
+ }
35
+ declare function parseSitemapIndex(xml: string): SitemapIndexParseResult;
36
+ declare function isSitemapIndex(xml: string): boolean;
26
37
 
27
- export { parseHtmlExtractSitemapMeta, parseSitemapXml };
28
- export type { SitemapParseResult, SitemapWarning };
38
+ export { isSitemapIndex, parseHtmlExtractSitemapMeta, parseSitemapIndex, parseSitemapXml };
39
+ export type { SitemapIndexEntry, SitemapIndexParseResult, SitemapParseResult, SitemapWarning };