aeorank 2.2.0 → 2.3.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 +42 -2
- package/dist/browser.js +28 -17
- package/dist/browser.js.map +1 -1
- package/dist/cli.js +28 -17
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +28 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -566,18 +566,21 @@ async function prefetchSiteData(domain) {
|
|
|
566
566
|
if (homepage) homepage.category = "homepage";
|
|
567
567
|
return { domain, protocol, homepage, llmsTxt, robotsTxt, faqPage, sitemapXml, rssFeed, aiTxt, redirectedTo: null, parkedReason: null, blogSample };
|
|
568
568
|
}
|
|
569
|
+
function stripScripts(html) {
|
|
570
|
+
return html.replace(/<script(?![^>]*type\s*=\s*["']application\/ld\+json["'])[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?<\/style>/gi, "");
|
|
571
|
+
}
|
|
569
572
|
function getCombinedHtml(data) {
|
|
570
|
-
const parts = [data.homepage?.text || ""];
|
|
573
|
+
const parts = [stripScripts(data.homepage?.text || "")];
|
|
571
574
|
if (data.blogSample) {
|
|
572
575
|
for (const page of data.blogSample) {
|
|
573
|
-
parts.push(page.text);
|
|
576
|
+
parts.push(stripScripts(page.text));
|
|
574
577
|
}
|
|
575
578
|
}
|
|
576
579
|
return parts.join("\n");
|
|
577
580
|
}
|
|
578
581
|
function getBlogHtml(data) {
|
|
579
582
|
if (!data.blogSample || data.blogSample.length === 0) return "";
|
|
580
|
-
return data.blogSample.map((p) => p.text).join("\n");
|
|
583
|
+
return data.blogSample.map((p) => stripScripts(p.text)).join("\n");
|
|
581
584
|
}
|
|
582
585
|
function checkLlmsTxt(data) {
|
|
583
586
|
const findings = [];
|
|
@@ -1775,14 +1778,17 @@ function checkQueryAnswerAlignment(data) {
|
|
|
1775
1778
|
}
|
|
1776
1779
|
let answered = 0;
|
|
1777
1780
|
for (const qHeading of questionHeadings) {
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1781
|
+
try {
|
|
1782
|
+
const escapedHeading = qHeading.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1783
|
+
const pattern = new RegExp(escapedHeading + "[\\s\\S]{0,200}?<\\/h[23]>([\\s\\S]{0,1500}?)(?=<h[1-6]|$)", "i");
|
|
1784
|
+
const match = pattern.exec(combinedHtml);
|
|
1785
|
+
if (match) {
|
|
1786
|
+
const afterContent = match[1].replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
1787
|
+
if (afterContent.length >= 20) {
|
|
1788
|
+
answered++;
|
|
1789
|
+
}
|
|
1785
1790
|
}
|
|
1791
|
+
} catch {
|
|
1786
1792
|
}
|
|
1787
1793
|
}
|
|
1788
1794
|
const rate = Math.round(answered / questionHeadings.length * 100);
|
|
@@ -2261,27 +2267,32 @@ function checkTopicCoherence(data) {
|
|
|
2261
2267
|
const bigramFocusRatio = blogPages.length > 0 ? dominantBigramCount / blogPages.length : 0;
|
|
2262
2268
|
let score = 0;
|
|
2263
2269
|
const bestFocusRatio = Math.max(focusRatio, bigramFocusRatio);
|
|
2270
|
+
const dominantPageCount = Math.max(dominantTermCount, dominantBigramCount);
|
|
2271
|
+
const hasStrongAbsolutePresence = dominantPageCount >= 10;
|
|
2264
2272
|
if (bestFocusRatio >= 0.8) {
|
|
2265
2273
|
score += 7;
|
|
2266
2274
|
} else if (bestFocusRatio >= 0.6) {
|
|
2267
2275
|
score += 6;
|
|
2268
|
-
} else if (bestFocusRatio >= 0.45) {
|
|
2276
|
+
} else if (bestFocusRatio >= 0.45 || hasStrongAbsolutePresence && bestFocusRatio >= 0.3) {
|
|
2269
2277
|
score += 5;
|
|
2270
|
-
} else if (bestFocusRatio >= 0.3) {
|
|
2271
|
-
score +=
|
|
2278
|
+
} else if (bestFocusRatio >= 0.3 || hasStrongAbsolutePresence && bestFocusRatio >= 0.2) {
|
|
2279
|
+
score += 4;
|
|
2272
2280
|
} else if (bestFocusRatio >= 0.15) {
|
|
2273
2281
|
score += 2;
|
|
2274
2282
|
} else {
|
|
2275
2283
|
score += 1;
|
|
2276
2284
|
}
|
|
2277
|
-
const clusterPenaltyReduced = focusRatio >= 0.7;
|
|
2278
|
-
|
|
2285
|
+
const clusterPenaltyReduced = focusRatio >= 0.7 || hasStrongAbsolutePresence;
|
|
2286
|
+
const scaledLow = Math.max(3, Math.floor(blogPages.length / 10));
|
|
2287
|
+
const scaledMid = Math.max(6, Math.floor(blogPages.length / 5));
|
|
2288
|
+
const scaledHigh = Math.max(10, Math.floor(blogPages.length / 3));
|
|
2289
|
+
if (topicClusterCount <= scaledLow) {
|
|
2279
2290
|
score += 3;
|
|
2280
2291
|
findings.push({ severity: "info", detail: `${topicClusterCount} topic cluster(s) - tightly focused content` });
|
|
2281
|
-
} else if (topicClusterCount <=
|
|
2292
|
+
} else if (topicClusterCount <= scaledMid) {
|
|
2282
2293
|
score += clusterPenaltyReduced ? 2 : 1;
|
|
2283
2294
|
findings.push({ severity: "info", detail: `${topicClusterCount} topic clusters${clusterPenaltyReduced ? " within a focused niche" : " - moderately focused"}` });
|
|
2284
|
-
} else if (topicClusterCount <=
|
|
2295
|
+
} else if (topicClusterCount <= scaledHigh) {
|
|
2285
2296
|
score += clusterPenaltyReduced ? 1 : 0;
|
|
2286
2297
|
if (!clusterPenaltyReduced) {
|
|
2287
2298
|
findings.push({ severity: "low", detail: `${topicClusterCount} topic clusters - scattered content`, fix: "Reduce the number of distinct topics. Focus blog content on 2-3 core expertise areas." });
|