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/cli.js
CHANGED
|
@@ -207,18 +207,21 @@ async function prefetchSiteData(domain) {
|
|
|
207
207
|
if (homepage) homepage.category = "homepage";
|
|
208
208
|
return { domain, protocol, homepage, llmsTxt, robotsTxt, faqPage, sitemapXml, rssFeed, aiTxt, redirectedTo: null, parkedReason: null, blogSample };
|
|
209
209
|
}
|
|
210
|
+
function stripScripts(html) {
|
|
211
|
+
return html.replace(/<script(?![^>]*type\s*=\s*["']application\/ld\+json["'])[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?<\/style>/gi, "");
|
|
212
|
+
}
|
|
210
213
|
function getCombinedHtml(data) {
|
|
211
|
-
const parts = [data.homepage?.text || ""];
|
|
214
|
+
const parts = [stripScripts(data.homepage?.text || "")];
|
|
212
215
|
if (data.blogSample) {
|
|
213
216
|
for (const page of data.blogSample) {
|
|
214
|
-
parts.push(page.text);
|
|
217
|
+
parts.push(stripScripts(page.text));
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
220
|
return parts.join("\n");
|
|
218
221
|
}
|
|
219
222
|
function getBlogHtml(data) {
|
|
220
223
|
if (!data.blogSample || data.blogSample.length === 0) return "";
|
|
221
|
-
return data.blogSample.map((p) => p.text).join("\n");
|
|
224
|
+
return data.blogSample.map((p) => stripScripts(p.text)).join("\n");
|
|
222
225
|
}
|
|
223
226
|
function checkLlmsTxt(data) {
|
|
224
227
|
const findings = [];
|
|
@@ -1416,14 +1419,17 @@ function checkQueryAnswerAlignment(data) {
|
|
|
1416
1419
|
}
|
|
1417
1420
|
let answered = 0;
|
|
1418
1421
|
for (const qHeading of questionHeadings) {
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1422
|
+
try {
|
|
1423
|
+
const escapedHeading = qHeading.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1424
|
+
const pattern = new RegExp(escapedHeading + "[\\s\\S]{0,200}?<\\/h[23]>([\\s\\S]{0,1500}?)(?=<h[1-6]|$)", "i");
|
|
1425
|
+
const match = pattern.exec(combinedHtml);
|
|
1426
|
+
if (match) {
|
|
1427
|
+
const afterContent = match[1].replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
1428
|
+
if (afterContent.length >= 20) {
|
|
1429
|
+
answered++;
|
|
1430
|
+
}
|
|
1426
1431
|
}
|
|
1432
|
+
} catch {
|
|
1427
1433
|
}
|
|
1428
1434
|
}
|
|
1429
1435
|
const rate = Math.round(answered / questionHeadings.length * 100);
|
|
@@ -1902,27 +1908,32 @@ function checkTopicCoherence(data) {
|
|
|
1902
1908
|
const bigramFocusRatio = blogPages.length > 0 ? dominantBigramCount / blogPages.length : 0;
|
|
1903
1909
|
let score = 0;
|
|
1904
1910
|
const bestFocusRatio = Math.max(focusRatio, bigramFocusRatio);
|
|
1911
|
+
const dominantPageCount = Math.max(dominantTermCount, dominantBigramCount);
|
|
1912
|
+
const hasStrongAbsolutePresence = dominantPageCount >= 10;
|
|
1905
1913
|
if (bestFocusRatio >= 0.8) {
|
|
1906
1914
|
score += 7;
|
|
1907
1915
|
} else if (bestFocusRatio >= 0.6) {
|
|
1908
1916
|
score += 6;
|
|
1909
|
-
} else if (bestFocusRatio >= 0.45) {
|
|
1917
|
+
} else if (bestFocusRatio >= 0.45 || hasStrongAbsolutePresence && bestFocusRatio >= 0.3) {
|
|
1910
1918
|
score += 5;
|
|
1911
|
-
} else if (bestFocusRatio >= 0.3) {
|
|
1912
|
-
score +=
|
|
1919
|
+
} else if (bestFocusRatio >= 0.3 || hasStrongAbsolutePresence && bestFocusRatio >= 0.2) {
|
|
1920
|
+
score += 4;
|
|
1913
1921
|
} else if (bestFocusRatio >= 0.15) {
|
|
1914
1922
|
score += 2;
|
|
1915
1923
|
} else {
|
|
1916
1924
|
score += 1;
|
|
1917
1925
|
}
|
|
1918
|
-
const clusterPenaltyReduced = focusRatio >= 0.7;
|
|
1919
|
-
|
|
1926
|
+
const clusterPenaltyReduced = focusRatio >= 0.7 || hasStrongAbsolutePresence;
|
|
1927
|
+
const scaledLow = Math.max(3, Math.floor(blogPages.length / 10));
|
|
1928
|
+
const scaledMid = Math.max(6, Math.floor(blogPages.length / 5));
|
|
1929
|
+
const scaledHigh = Math.max(10, Math.floor(blogPages.length / 3));
|
|
1930
|
+
if (topicClusterCount <= scaledLow) {
|
|
1920
1931
|
score += 3;
|
|
1921
1932
|
findings.push({ severity: "info", detail: `${topicClusterCount} topic cluster(s) - tightly focused content` });
|
|
1922
|
-
} else if (topicClusterCount <=
|
|
1933
|
+
} else if (topicClusterCount <= scaledMid) {
|
|
1923
1934
|
score += clusterPenaltyReduced ? 2 : 1;
|
|
1924
1935
|
findings.push({ severity: "info", detail: `${topicClusterCount} topic clusters${clusterPenaltyReduced ? " within a focused niche" : " - moderately focused"}` });
|
|
1925
|
-
} else if (topicClusterCount <=
|
|
1936
|
+
} else if (topicClusterCount <= scaledHigh) {
|
|
1926
1937
|
score += clusterPenaltyReduced ? 1 : 0;
|
|
1927
1938
|
if (!clusterPenaltyReduced) {
|
|
1928
1939
|
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." });
|