@uxf/scripts 11.62.3 → 11.64.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/package.json +1 -1
- package/src/uxf-sitemap-check/index.js +26 -17
package/package.json
CHANGED
|
@@ -254,7 +254,7 @@ async function fetchUrl(url, webUrl, parentUrl = undefined, ttl = 1) {
|
|
|
254
254
|
url,
|
|
255
255
|
parentUrl,
|
|
256
256
|
isImg: isImageUrl(url),
|
|
257
|
-
isWebPage: response.headers.get("content-type")
|
|
257
|
+
isWebPage: response.headers.get("content-type")?.includes("text/html") ?? true,
|
|
258
258
|
ttl,
|
|
259
259
|
status: response.status,
|
|
260
260
|
skipped: false,
|
|
@@ -301,7 +301,7 @@ async function testUrl(url, webUrl, parentUrl = undefined) {
|
|
|
301
301
|
redirected: result.redirected,
|
|
302
302
|
indexable:
|
|
303
303
|
result.isWebPage && typeof result.html === "string"
|
|
304
|
-
? cheerio.load(result.html)("meta[name='robots']").attr("content")
|
|
304
|
+
? !cheerio.load(result.html)("meta[name='robots']").attr("content")?.includes("noindex")
|
|
305
305
|
: false,
|
|
306
306
|
canonicalUrl:
|
|
307
307
|
result.isWebPage && typeof result.html === "string"
|
|
@@ -590,25 +590,34 @@ module.exports = async function run(sitemapUrl, skip, withNested, withImages, ch
|
|
|
590
590
|
|
|
591
591
|
logInitialInfo(sitemapUrl, webUrl, withNested, withImages, checkMissing, shouldReportMissing);
|
|
592
592
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
593
|
+
try {
|
|
594
|
+
const startTime = performance.now();
|
|
595
|
+
const sitemapUrls = await Sitemap.getSitemap(sitemapUrl);
|
|
596
|
+
await testSitemapUrls(sitemapUrls, webUrl, sitemapUrl, skip, withNested, withImages);
|
|
597
|
+
const finishTime = performance.now();
|
|
597
598
|
|
|
598
|
-
|
|
599
|
+
const result = getResult(webUrl, sitemapUrls, shouldReportMissing);
|
|
599
600
|
|
|
600
|
-
|
|
601
|
-
|
|
601
|
+
if (result.errorsSum > 0) {
|
|
602
|
+
const chatMessage = logResultErrors(webUrl, result);
|
|
602
603
|
|
|
603
|
-
|
|
604
|
-
|
|
604
|
+
await sendGoogleChatMessage(chatMessage, googleWebhookUrl);
|
|
605
|
+
}
|
|
605
606
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
607
|
+
if (result.skippedUrls.length > 0) {
|
|
608
|
+
const skippedUrlsText = createSkippedResult(result.skippedUrls);
|
|
609
|
+
logErrors(skippedUrlsText, "\nSkipped origins:\n");
|
|
610
|
+
}
|
|
610
611
|
|
|
611
|
-
|
|
612
|
+
logStatistics(result.ok, Math.ceil(finishTime - startTime));
|
|
613
|
+
|
|
614
|
+
process.exit(result.errorsSum > 0 ? 1 : 0);
|
|
615
|
+
} catch (e) {
|
|
616
|
+
stdout.write("⛔ Error: " + e.message + "\n");
|
|
617
|
+
|
|
618
|
+
await sendGoogleChatMessage(`Sitemap check failed completely:\n\n${e.message}`, googleWebhookUrl);
|
|
619
|
+
|
|
620
|
+
process.exit(1);
|
|
621
|
+
}
|
|
612
622
|
|
|
613
|
-
process.exit(result.errorsSum > 0 ? 1 : 0);
|
|
614
623
|
};
|