diff --git a/src/sitemap/handler.js b/src/sitemap/handler.js index d84fba34..0c9458d0 100644 --- a/src/sitemap/handler.js +++ b/src/sitemap/handler.js @@ -215,13 +215,16 @@ export async function getBaseUrlPagesFromSitemaps(baseUrl, urls, log) { if (urlData.existsAndIsValid) { if (urlData.details && urlData.details.isSitemapIndex) { log.info(`Sitemap Index found: ${url}`); - // eslint-disable-next-line max-len + // Ensure we await the result of getSitemapUrlsFromSitemapIndex + // eslint-disable-next-line no-await-in-loop,max-len const extractedSitemaps = getSitemapUrlsFromSitemapIndex(urlData.details.sitemapContent, log, fetchContent); - log.info(`Extracted Sitemaps from Index: ${extractedSitemaps}`); + log.info(`Extracted Sitemaps from Index: ${JSON.stringify(extractedSitemaps)}`); + for (const extractedSitemapUrl of extractedSitemaps) { if (!contentsCache[extractedSitemapUrl]) { matchingUrls.push(extractedSitemapUrl); try { + // Fetch contents for each sitemap URL // eslint-disable-next-line no-await-in-loop await fillSitemapContents(extractedSitemapUrl); } catch (err) { diff --git a/src/support/utils.js b/src/support/utils.js index f58bdb69..63535d9a 100644 --- a/src/support/utils.js +++ b/src/support/utils.js @@ -168,8 +168,8 @@ export async function getSitemapUrlsFromSitemapIndex(content, log, fetchContent) for (const sitemapUrl of sitemapUrls) { log.info(`Processing sitemap: ${sitemapUrl}`); - // Fetch the content of each sitemap URL try { + // Fetch the content of each sitemap URL // eslint-disable-next-line no-await-in-loop const sitemapContent = await fetchContent(sitemapUrl);