aeorank 2.3.0 → 2.3.2

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/dist/index.cjs CHANGED
@@ -324,6 +324,7 @@ __export(index_exports, {
324
324
  analyzeAllPages: () => analyzeAllPages,
325
325
  analyzePage: () => analyzePage,
326
326
  audit: () => audit,
327
+ auditSite: () => auditSite,
327
328
  auditSiteFromData: () => auditSiteFromData,
328
329
  buildDetailedFindings: () => buildDetailedFindings,
329
330
  buildLinkGraph: () => buildLinkGraph,
@@ -332,6 +333,7 @@ __export(index_exports, {
332
333
  calculateOverallScore: () => calculateOverallScore,
333
334
  classifyRendering: () => classifyRendering,
334
335
  compare: () => compare,
336
+ countRecentSitemapDates: () => countRecentSitemapDates,
335
337
  crawlFullSite: () => crawlFullSite,
336
338
  detectClusters: () => detectClusters,
337
339
  detectHubs: () => detectHubs,
@@ -542,16 +544,20 @@ async function prefetchSiteData(domain) {
542
544
  }
543
545
  }
544
546
  }
545
- let blogSample = [];
546
- if (sitemapXml && sitemapXml.status === 200) {
547
- let sitemapForBlog = sitemapXml.text;
548
- const subSitemapUrl = extractSubSitemapUrl(sitemapForBlog);
549
- if (subSitemapUrl) {
550
- const subSitemap = await fetchText(subSitemapUrl);
551
- if (subSitemap && subSitemap.status === 200) {
552
- sitemapForBlog = subSitemap.text;
547
+ if (sitemapXml && sitemapXml.status === 200 && sitemapXml.text.includes("<sitemapindex")) {
548
+ const subUrls = extractAllSubSitemapUrls(sitemapXml.text, 5);
549
+ if (subUrls.length > 0) {
550
+ const subResults = await Promise.all(subUrls.map((u) => fetchText(u)));
551
+ for (const sub of subResults) {
552
+ if (sub && sub.status === 200) {
553
+ sitemapXml.text += "\n" + sub.text;
554
+ }
553
555
  }
554
556
  }
557
+ }
558
+ let blogSample = [];
559
+ if (sitemapXml && sitemapXml.status === 200) {
560
+ const sitemapForBlog = sitemapXml.text;
555
561
  const blogUrls = extractBlogUrlsFromSitemap(sitemapForBlog, domain, 50);
556
562
  if (blogUrls.length > 0) {
557
563
  const fetched = await Promise.all(blogUrls.map((url) => fetchText(url)));
@@ -1596,16 +1602,16 @@ function extractBlogUrlsFromSitemap(sitemapText, domain, limit = 50) {
1596
1602
  });
1597
1603
  return candidates.slice(0, limit).map((c) => c.url);
1598
1604
  }
1599
- function extractSubSitemapUrl(sitemapText) {
1600
- if (!sitemapText.includes("<sitemapindex")) return null;
1605
+ function extractAllSubSitemapUrls(sitemapText, limit = 5) {
1606
+ if (!sitemapText.includes("<sitemapindex")) return [];
1601
1607
  const sitemapLocs = sitemapText.match(/<sitemap>[\s\S]*?<loc>([^<]+)<\/loc>[\s\S]*?<\/sitemap>/gi) || [];
1602
- if (sitemapLocs.length === 0) return null;
1603
1608
  const urls = sitemapLocs.map((block) => {
1604
1609
  const match = block.match(/<loc>([^<]+)<\/loc>/i);
1605
1610
  return match ? match[1].trim() : "";
1606
1611
  }).filter(Boolean);
1607
- const preferred = urls.find((u) => /post|blog|article/i.test(u));
1608
- return preferred || urls[0] || null;
1612
+ const preferred = urls.filter((u) => /post|blog|article|page/i.test(u));
1613
+ const rest = urls.filter((u) => !preferred.includes(u));
1614
+ return [...preferred, ...rest].slice(0, limit);
1609
1615
  }
1610
1616
  function checkContentVelocity(data) {
1611
1617
  const findings = [];
@@ -2434,6 +2440,12 @@ function auditSiteFromData(data) {
2434
2440
  checkContentDepth(data, topicCoherence.score)
2435
2441
  ];
2436
2442
  }
2443
+ async function auditSite(targetUrl) {
2444
+ const url = new URL(targetUrl.startsWith("http") ? targetUrl : `https://${targetUrl}`);
2445
+ const domain = url.hostname.replace(/^www\./, "");
2446
+ const data = await prefetchSiteData(domain);
2447
+ return auditSiteFromData(data);
2448
+ }
2437
2449
 
2438
2450
  // src/scoring.ts
2439
2451
  var WEIGHTS = {
@@ -5584,6 +5596,7 @@ async function compare(domainA, domainB, options) {
5584
5596
  analyzeAllPages,
5585
5597
  analyzePage,
5586
5598
  audit,
5599
+ auditSite,
5587
5600
  auditSiteFromData,
5588
5601
  buildDetailedFindings,
5589
5602
  buildLinkGraph,
@@ -5592,6 +5605,7 @@ async function compare(domainA, domainB, options) {
5592
5605
  calculateOverallScore,
5593
5606
  classifyRendering,
5594
5607
  compare,
5608
+ countRecentSitemapDates,
5595
5609
  crawlFullSite,
5596
5610
  detectClusters,
5597
5611
  detectHubs,