aeorank 1.0.0 → 1.2.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 +89 -1
- package/data/benchmark.json +342302 -0
- package/data/sectors.json +1006 -0
- package/data/yc.json +168015 -0
- package/dist/cli.js +406 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +329 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.js +326 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/dist/index.d.cts
CHANGED
|
@@ -331,4 +331,61 @@ interface ParkedDomainResult {
|
|
|
331
331
|
*/
|
|
332
332
|
declare function detectParkedDomain(bodySnippet: string): ParkedDomainResult;
|
|
333
333
|
|
|
334
|
-
|
|
334
|
+
/**
|
|
335
|
+
* HTML report generator for AEORank audits.
|
|
336
|
+
* Produces self-contained HTML with inline CSS - zero external dependencies.
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
declare function generateHtmlReport(result: AuditResult): string;
|
|
340
|
+
interface CriterionComparisonLike {
|
|
341
|
+
id: number;
|
|
342
|
+
criterion: string;
|
|
343
|
+
scoreA: number;
|
|
344
|
+
scoreB: number;
|
|
345
|
+
delta: number;
|
|
346
|
+
statusA: string;
|
|
347
|
+
statusB: string;
|
|
348
|
+
}
|
|
349
|
+
interface ComparisonResultLike {
|
|
350
|
+
siteA: AuditResult;
|
|
351
|
+
siteB: AuditResult;
|
|
352
|
+
comparison: {
|
|
353
|
+
scoreDelta: number;
|
|
354
|
+
criteria: CriterionComparisonLike[];
|
|
355
|
+
siteAAdvantages: string[];
|
|
356
|
+
siteBAdvantages: string[];
|
|
357
|
+
tied: string[];
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
declare function generateComparisonHtmlReport(result: ComparisonResultLike): string;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Comparison mode - run two audits in parallel and compute per-criterion deltas.
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
interface CriterionComparison {
|
|
367
|
+
id: number;
|
|
368
|
+
criterion: string;
|
|
369
|
+
scoreA: number;
|
|
370
|
+
scoreB: number;
|
|
371
|
+
delta: number;
|
|
372
|
+
statusA: string;
|
|
373
|
+
statusB: string;
|
|
374
|
+
}
|
|
375
|
+
interface ComparisonResult {
|
|
376
|
+
siteA: AuditResult;
|
|
377
|
+
siteB: AuditResult;
|
|
378
|
+
comparison: {
|
|
379
|
+
scoreDelta: number;
|
|
380
|
+
criteria: CriterionComparison[];
|
|
381
|
+
siteAAdvantages: string[];
|
|
382
|
+
siteBAdvantages: string[];
|
|
383
|
+
tied: string[];
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Audit two domains in parallel and build a per-criterion comparison.
|
|
388
|
+
*/
|
|
389
|
+
declare function compare(domainA: string, domainB: string, options?: AuditOptions): Promise<ComparisonResult>;
|
|
390
|
+
|
|
391
|
+
export { type AuditData, type AuditFinding, type AuditOptions, type AuditResult, type AuditStatus, CRITERION_LABELS, type ComparisonResult, type CriterionComparison, type CriterionDetail, type CriterionResult, type Deliverable, type DetailedFinding, type FetchResult, type FindingSeverity, type FindingType, type HeadlessOptions, type ImpactLevel, type PageCategory$1 as PageCategory, type PageIssue$1 as PageIssue, type PageReview$1 as PageReview, type ParkedDomainResult, type PitchMetric, type Priority, type RawDataSummary, type RenderingMethod, type ScoreCardItem, type Severity, type SiteData, type Status, analyzeAllPages, analyzePage, audit, auditSiteFromData, buildDetailedFindings, buildScorecard, calculateOverallScore, classifyRendering, compare, detectParkedDomain, extractContentPagesFromSitemap, extractNavLinks, extractRawDataSummary, fetchMultiPageData, fetchWithHeadless, generateBottomLine, generateComparisonHtmlReport, generateHtmlReport, generateOpportunities, generatePitchNumbers, generateVerdict, isSpaShell, prefetchSiteData, scoreToStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -331,4 +331,61 @@ interface ParkedDomainResult {
|
|
|
331
331
|
*/
|
|
332
332
|
declare function detectParkedDomain(bodySnippet: string): ParkedDomainResult;
|
|
333
333
|
|
|
334
|
-
|
|
334
|
+
/**
|
|
335
|
+
* HTML report generator for AEORank audits.
|
|
336
|
+
* Produces self-contained HTML with inline CSS - zero external dependencies.
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
declare function generateHtmlReport(result: AuditResult): string;
|
|
340
|
+
interface CriterionComparisonLike {
|
|
341
|
+
id: number;
|
|
342
|
+
criterion: string;
|
|
343
|
+
scoreA: number;
|
|
344
|
+
scoreB: number;
|
|
345
|
+
delta: number;
|
|
346
|
+
statusA: string;
|
|
347
|
+
statusB: string;
|
|
348
|
+
}
|
|
349
|
+
interface ComparisonResultLike {
|
|
350
|
+
siteA: AuditResult;
|
|
351
|
+
siteB: AuditResult;
|
|
352
|
+
comparison: {
|
|
353
|
+
scoreDelta: number;
|
|
354
|
+
criteria: CriterionComparisonLike[];
|
|
355
|
+
siteAAdvantages: string[];
|
|
356
|
+
siteBAdvantages: string[];
|
|
357
|
+
tied: string[];
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
declare function generateComparisonHtmlReport(result: ComparisonResultLike): string;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Comparison mode - run two audits in parallel and compute per-criterion deltas.
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
interface CriterionComparison {
|
|
367
|
+
id: number;
|
|
368
|
+
criterion: string;
|
|
369
|
+
scoreA: number;
|
|
370
|
+
scoreB: number;
|
|
371
|
+
delta: number;
|
|
372
|
+
statusA: string;
|
|
373
|
+
statusB: string;
|
|
374
|
+
}
|
|
375
|
+
interface ComparisonResult {
|
|
376
|
+
siteA: AuditResult;
|
|
377
|
+
siteB: AuditResult;
|
|
378
|
+
comparison: {
|
|
379
|
+
scoreDelta: number;
|
|
380
|
+
criteria: CriterionComparison[];
|
|
381
|
+
siteAAdvantages: string[];
|
|
382
|
+
siteBAdvantages: string[];
|
|
383
|
+
tied: string[];
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Audit two domains in parallel and build a per-criterion comparison.
|
|
388
|
+
*/
|
|
389
|
+
declare function compare(domainA: string, domainB: string, options?: AuditOptions): Promise<ComparisonResult>;
|
|
390
|
+
|
|
391
|
+
export { type AuditData, type AuditFinding, type AuditOptions, type AuditResult, type AuditStatus, CRITERION_LABELS, type ComparisonResult, type CriterionComparison, type CriterionDetail, type CriterionResult, type Deliverable, type DetailedFinding, type FetchResult, type FindingSeverity, type FindingType, type HeadlessOptions, type ImpactLevel, type PageCategory$1 as PageCategory, type PageIssue$1 as PageIssue, type PageReview$1 as PageReview, type ParkedDomainResult, type PitchMetric, type Priority, type RawDataSummary, type RenderingMethod, type ScoreCardItem, type Severity, type SiteData, type Status, analyzeAllPages, analyzePage, audit, auditSiteFromData, buildDetailedFindings, buildScorecard, calculateOverallScore, classifyRendering, compare, detectParkedDomain, extractContentPagesFromSitemap, extractNavLinks, extractRawDataSummary, fetchMultiPageData, fetchWithHeadless, generateBottomLine, generateComparisonHtmlReport, generateHtmlReport, generateOpportunities, generatePitchNumbers, generateVerdict, isSpaShell, prefetchSiteData, scoreToStatus };
|
package/dist/index.js
CHANGED
|
@@ -2509,6 +2509,329 @@ async function audit(domain, options) {
|
|
|
2509
2509
|
...renderedWithHeadless && { renderedWithHeadless: true }
|
|
2510
2510
|
};
|
|
2511
2511
|
}
|
|
2512
|
+
|
|
2513
|
+
// src/html-report.ts
|
|
2514
|
+
function scoreColor(score) {
|
|
2515
|
+
if (score <= 40) return "#F44336";
|
|
2516
|
+
if (score <= 55) return "#FF9800";
|
|
2517
|
+
if (score <= 70) return "#FFC107";
|
|
2518
|
+
if (score <= 85) return "#4CAF50";
|
|
2519
|
+
return "#2E7D32";
|
|
2520
|
+
}
|
|
2521
|
+
function criterionColor(score) {
|
|
2522
|
+
return scoreColor(score * 10);
|
|
2523
|
+
}
|
|
2524
|
+
function escapeHtml(str) {
|
|
2525
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2526
|
+
}
|
|
2527
|
+
function scoreCircleSvg(score, size = 160) {
|
|
2528
|
+
const radius = (size - 16) / 2;
|
|
2529
|
+
const circumference = 2 * Math.PI * radius;
|
|
2530
|
+
const progress = score / 100 * circumference;
|
|
2531
|
+
const color = scoreColor(score);
|
|
2532
|
+
return `<svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
|
|
2533
|
+
<circle cx="${size / 2}" cy="${size / 2}" r="${radius}" fill="none" stroke="#e0e0e0" stroke-width="10"/>
|
|
2534
|
+
<circle cx="${size / 2}" cy="${size / 2}" r="${radius}" fill="none" stroke="${color}" stroke-width="10"
|
|
2535
|
+
stroke-dasharray="${circumference}" stroke-dashoffset="${circumference - progress}"
|
|
2536
|
+
stroke-linecap="round" transform="rotate(-90 ${size / 2} ${size / 2})"/>
|
|
2537
|
+
<text x="${size / 2}" y="${size / 2 + 2}" text-anchor="middle" dominant-baseline="middle"
|
|
2538
|
+
font-size="42" font-weight="700" fill="${color}">${score}</text>
|
|
2539
|
+
<text x="${size / 2}" y="${size / 2 + 24}" text-anchor="middle" dominant-baseline="middle"
|
|
2540
|
+
font-size="13" fill="#666">/100</text>
|
|
2541
|
+
</svg>`;
|
|
2542
|
+
}
|
|
2543
|
+
var CSS = `
|
|
2544
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
2545
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #1a1a1a; background: #f8f9fa; line-height: 1.6; }
|
|
2546
|
+
.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
|
|
2547
|
+
.header { text-align: center; margin-bottom: 40px; }
|
|
2548
|
+
.header h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
|
|
2549
|
+
.header .date { color: #666; font-size: 14px; }
|
|
2550
|
+
.score-section { display: flex; justify-content: center; margin: 24px 0 32px; }
|
|
2551
|
+
.verdict { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px 24px; margin-bottom: 32px; font-size: 15px; color: #333; }
|
|
2552
|
+
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; color: #1a1a1a; }
|
|
2553
|
+
.scorecard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 32px; }
|
|
2554
|
+
.criterion-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
|
|
2555
|
+
.criterion-bar { width: 80px; height: 8px; background: #e0e0e0; border-radius: 4px; flex-shrink: 0; overflow: hidden; }
|
|
2556
|
+
.criterion-bar-fill { height: 100%; border-radius: 4px; }
|
|
2557
|
+
.criterion-score { font-size: 14px; font-weight: 700; min-width: 32px; text-align: center; }
|
|
2558
|
+
.criterion-name { font-size: 13px; flex: 1; }
|
|
2559
|
+
.criterion-status { font-size: 11px; color: #666; background: #f0f0f0; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
|
|
2560
|
+
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; margin-bottom: 32px; }
|
|
2561
|
+
th { background: #f5f5f5; text-align: left; padding: 10px 14px; font-size: 13px; font-weight: 600; color: #555; border-bottom: 1px solid #e0e0e0; }
|
|
2562
|
+
td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
|
|
2563
|
+
.impact-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; color: #fff; }
|
|
2564
|
+
.impact-critical { background: #F44336; }
|
|
2565
|
+
.impact-high { background: #FF5722; }
|
|
2566
|
+
.impact-quick-win { background: #4CAF50; }
|
|
2567
|
+
.impact-core-aeo { background: #2196F3; }
|
|
2568
|
+
.impact-medium { background: #FF9800; }
|
|
2569
|
+
.impact-low { background: #9E9E9E; }
|
|
2570
|
+
.impact-big-opportunity { background: #9C27B0; }
|
|
2571
|
+
.impact-measurement { background: #607D8B; }
|
|
2572
|
+
.bottom-line { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px 24px; margin-bottom: 32px; font-size: 15px; }
|
|
2573
|
+
.footer { text-align: center; color: #999; font-size: 12px; padding: 24px 0; border-top: 1px solid #e0e0e0; margin-top: 24px; }
|
|
2574
|
+
.compare-header { display: flex; justify-content: center; align-items: center; gap: 48px; margin-bottom: 32px; }
|
|
2575
|
+
.compare-site { text-align: center; }
|
|
2576
|
+
.compare-site h2 { font-size: 20px; margin-bottom: 8px; }
|
|
2577
|
+
.compare-vs { font-size: 24px; font-weight: 700; color: #999; }
|
|
2578
|
+
.delta-positive { color: #4CAF50; font-weight: 600; }
|
|
2579
|
+
.delta-negative { color: #F44336; font-weight: 600; }
|
|
2580
|
+
.delta-zero { color: #999; }
|
|
2581
|
+
.summary-box { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 16px 20px; margin-bottom: 24px; display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
|
|
2582
|
+
.summary-stat { text-align: center; }
|
|
2583
|
+
.summary-stat .num { font-size: 28px; font-weight: 700; }
|
|
2584
|
+
.summary-stat .label { font-size: 12px; color: #666; }
|
|
2585
|
+
@media print {
|
|
2586
|
+
body { background: #fff; }
|
|
2587
|
+
.container { padding: 0; }
|
|
2588
|
+
.criterion-card, .verdict, .bottom-line, table { break-inside: avoid; }
|
|
2589
|
+
}
|
|
2590
|
+
@media (max-width: 640px) {
|
|
2591
|
+
.scorecard-grid { grid-template-columns: 1fr; }
|
|
2592
|
+
.compare-header { flex-direction: column; gap: 16px; }
|
|
2593
|
+
}
|
|
2594
|
+
`;
|
|
2595
|
+
function impactClass(impact) {
|
|
2596
|
+
const key = impact.toLowerCase().replace(/\s+/g, "-");
|
|
2597
|
+
return `impact-${key}`;
|
|
2598
|
+
}
|
|
2599
|
+
function generateHtmlReport(result) {
|
|
2600
|
+
const domain = escapeHtml(result.site);
|
|
2601
|
+
const date = escapeHtml(result.auditDate);
|
|
2602
|
+
const scorecardCards = result.scorecard.map((item) => {
|
|
2603
|
+
const color = criterionColor(item.score);
|
|
2604
|
+
const width = item.score * 10;
|
|
2605
|
+
return `<div class="criterion-card">
|
|
2606
|
+
<div class="criterion-bar"><div class="criterion-bar-fill" style="width:${width}%;background:${color}"></div></div>
|
|
2607
|
+
<span class="criterion-score" style="color:${color}">${item.score}/10</span>
|
|
2608
|
+
<span class="criterion-name">${escapeHtml(item.criterion)}</span>
|
|
2609
|
+
<span class="criterion-status">${escapeHtml(item.status)}</span>
|
|
2610
|
+
</div>`;
|
|
2611
|
+
}).join("\n");
|
|
2612
|
+
const opportunityRows = result.opportunities.map((opp) => {
|
|
2613
|
+
const cls = impactClass(opp.impact);
|
|
2614
|
+
return `<tr>
|
|
2615
|
+
<td>${opp.id}</td>
|
|
2616
|
+
<td>${escapeHtml(opp.name)}</td>
|
|
2617
|
+
<td><span class="impact-badge ${cls}">${escapeHtml(opp.impact)}</span></td>
|
|
2618
|
+
<td>${escapeHtml(opp.effort)}</td>
|
|
2619
|
+
<td>${escapeHtml(opp.description)}</td>
|
|
2620
|
+
</tr>`;
|
|
2621
|
+
}).join("\n");
|
|
2622
|
+
const pagesRows = (result.pagesReviewed || []).map((page) => {
|
|
2623
|
+
const issueCount = page.issues.length;
|
|
2624
|
+
const strengthCount = page.strengths.length;
|
|
2625
|
+
return `<tr>
|
|
2626
|
+
<td>${escapeHtml(page.url)}</td>
|
|
2627
|
+
<td>${escapeHtml(page.category)}</td>
|
|
2628
|
+
<td>${page.wordCount}</td>
|
|
2629
|
+
<td>${issueCount}</td>
|
|
2630
|
+
<td>${strengthCount}</td>
|
|
2631
|
+
</tr>`;
|
|
2632
|
+
}).join("\n");
|
|
2633
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2634
|
+
return `<!DOCTYPE html>
|
|
2635
|
+
<html lang="en">
|
|
2636
|
+
<head>
|
|
2637
|
+
<meta charset="UTF-8">
|
|
2638
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2639
|
+
<title>AEORank Report - ${domain}</title>
|
|
2640
|
+
<style>${CSS}</style>
|
|
2641
|
+
</head>
|
|
2642
|
+
<body>
|
|
2643
|
+
<div class="container">
|
|
2644
|
+
<div class="header">
|
|
2645
|
+
<h1>${domain}</h1>
|
|
2646
|
+
<div class="date">AEO Audit - ${date}</div>
|
|
2647
|
+
</div>
|
|
2648
|
+
|
|
2649
|
+
<div class="score-section">
|
|
2650
|
+
${scoreCircleSvg(result.overallScore)}
|
|
2651
|
+
</div>
|
|
2652
|
+
|
|
2653
|
+
<div class="verdict">${escapeHtml(result.verdict)}</div>
|
|
2654
|
+
|
|
2655
|
+
<h2 class="section-title">Scorecard (23 Criteria)</h2>
|
|
2656
|
+
<div class="scorecard-grid">
|
|
2657
|
+
${scorecardCards}
|
|
2658
|
+
</div>
|
|
2659
|
+
|
|
2660
|
+
${result.opportunities.length > 0 ? `
|
|
2661
|
+
<h2 class="section-title">Opportunities (${result.opportunities.length})</h2>
|
|
2662
|
+
<table>
|
|
2663
|
+
<thead><tr><th>#</th><th>Opportunity</th><th>Impact</th><th>Effort</th><th>Description</th></tr></thead>
|
|
2664
|
+
<tbody>${opportunityRows}</tbody>
|
|
2665
|
+
</table>
|
|
2666
|
+
` : ""}
|
|
2667
|
+
|
|
2668
|
+
${(result.pagesReviewed || []).length > 0 ? `
|
|
2669
|
+
<h2 class="section-title">Pages Reviewed (${(result.pagesReviewed || []).length})</h2>
|
|
2670
|
+
<table>
|
|
2671
|
+
<thead><tr><th>URL</th><th>Category</th><th>Words</th><th>Issues</th><th>Strengths</th></tr></thead>
|
|
2672
|
+
<tbody>${pagesRows}</tbody>
|
|
2673
|
+
</table>
|
|
2674
|
+
` : ""}
|
|
2675
|
+
|
|
2676
|
+
<div class="bottom-line"><strong>Bottom line:</strong> ${escapeHtml(result.bottomLine)}</div>
|
|
2677
|
+
|
|
2678
|
+
<div class="footer">Generated by AEORank - ${now}</div>
|
|
2679
|
+
</div>
|
|
2680
|
+
</body>
|
|
2681
|
+
</html>`;
|
|
2682
|
+
}
|
|
2683
|
+
function generateComparisonHtmlReport(result) {
|
|
2684
|
+
const domainA = escapeHtml(result.siteA.site);
|
|
2685
|
+
const domainB = escapeHtml(result.siteB.site);
|
|
2686
|
+
const scoreA = result.siteA.overallScore;
|
|
2687
|
+
const scoreB = result.siteB.overallScore;
|
|
2688
|
+
const criteriaRows = result.comparison.criteria.map((c) => {
|
|
2689
|
+
const colorA = criterionColor(c.scoreA);
|
|
2690
|
+
const colorB = criterionColor(c.scoreB);
|
|
2691
|
+
const widthA = c.scoreA * 10;
|
|
2692
|
+
const widthB = c.scoreB * 10;
|
|
2693
|
+
let deltaHtml;
|
|
2694
|
+
if (c.delta > 0) deltaHtml = `<span class="delta-positive">+${c.delta}</span>`;
|
|
2695
|
+
else if (c.delta < 0) deltaHtml = `<span class="delta-negative">${c.delta}</span>`;
|
|
2696
|
+
else deltaHtml = `<span class="delta-zero">0</span>`;
|
|
2697
|
+
return `<tr>
|
|
2698
|
+
<td>${c.id}</td>
|
|
2699
|
+
<td>${escapeHtml(c.criterion)}</td>
|
|
2700
|
+
<td>
|
|
2701
|
+
<div style="display:flex;align-items:center;gap:8px">
|
|
2702
|
+
<div class="criterion-bar"><div class="criterion-bar-fill" style="width:${widthA}%;background:${colorA}"></div></div>
|
|
2703
|
+
<span style="color:${colorA};font-weight:600">${c.scoreA}</span>
|
|
2704
|
+
</div>
|
|
2705
|
+
</td>
|
|
2706
|
+
<td>
|
|
2707
|
+
<div style="display:flex;align-items:center;gap:8px">
|
|
2708
|
+
<div class="criterion-bar"><div class="criterion-bar-fill" style="width:${widthB}%;background:${colorB}"></div></div>
|
|
2709
|
+
<span style="color:${colorB};font-weight:600">${c.scoreB}</span>
|
|
2710
|
+
</div>
|
|
2711
|
+
</td>
|
|
2712
|
+
<td style="text-align:center">${deltaHtml}</td>
|
|
2713
|
+
</tr>`;
|
|
2714
|
+
}).join("\n");
|
|
2715
|
+
const advantagesA = result.comparison.siteAAdvantages.length;
|
|
2716
|
+
const advantagesB = result.comparison.siteBAdvantages.length;
|
|
2717
|
+
const tied = result.comparison.tied.length;
|
|
2718
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2719
|
+
return `<!DOCTYPE html>
|
|
2720
|
+
<html lang="en">
|
|
2721
|
+
<head>
|
|
2722
|
+
<meta charset="UTF-8">
|
|
2723
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2724
|
+
<title>AEORank Comparison - ${domainA} vs ${domainB}</title>
|
|
2725
|
+
<style>${CSS}</style>
|
|
2726
|
+
</head>
|
|
2727
|
+
<body>
|
|
2728
|
+
<div class="container">
|
|
2729
|
+
<div class="header">
|
|
2730
|
+
<h1>AEO Comparison</h1>
|
|
2731
|
+
</div>
|
|
2732
|
+
|
|
2733
|
+
<div class="compare-header">
|
|
2734
|
+
<div class="compare-site">
|
|
2735
|
+
<h2>${domainA}</h2>
|
|
2736
|
+
${scoreCircleSvg(scoreA, 120)}
|
|
2737
|
+
</div>
|
|
2738
|
+
<div class="compare-vs">vs</div>
|
|
2739
|
+
<div class="compare-site">
|
|
2740
|
+
<h2>${domainB}</h2>
|
|
2741
|
+
${scoreCircleSvg(scoreB, 120)}
|
|
2742
|
+
</div>
|
|
2743
|
+
</div>
|
|
2744
|
+
|
|
2745
|
+
<div class="summary-box">
|
|
2746
|
+
<div class="summary-stat">
|
|
2747
|
+
<div class="num" style="color:${scoreColor(scoreA)}">${advantagesA}</div>
|
|
2748
|
+
<div class="label">${domainA} leads</div>
|
|
2749
|
+
</div>
|
|
2750
|
+
<div class="summary-stat">
|
|
2751
|
+
<div class="num" style="color:${scoreColor(scoreB)}">${advantagesB}</div>
|
|
2752
|
+
<div class="label">${domainB} leads</div>
|
|
2753
|
+
</div>
|
|
2754
|
+
<div class="summary-stat">
|
|
2755
|
+
<div class="num" style="color:#999">${tied}</div>
|
|
2756
|
+
<div class="label">Tied</div>
|
|
2757
|
+
</div>
|
|
2758
|
+
</div>
|
|
2759
|
+
|
|
2760
|
+
<h2 class="section-title">Per-Criterion Comparison</h2>
|
|
2761
|
+
<table>
|
|
2762
|
+
<thead>
|
|
2763
|
+
<tr>
|
|
2764
|
+
<th>#</th>
|
|
2765
|
+
<th>Criterion</th>
|
|
2766
|
+
<th>${domainA}</th>
|
|
2767
|
+
<th>${domainB}</th>
|
|
2768
|
+
<th>Delta</th>
|
|
2769
|
+
</tr>
|
|
2770
|
+
</thead>
|
|
2771
|
+
<tbody>${criteriaRows}</tbody>
|
|
2772
|
+
</table>
|
|
2773
|
+
|
|
2774
|
+
${result.comparison.siteAAdvantages.length > 0 ? `
|
|
2775
|
+
<h2 class="section-title">${domainA} Advantages</h2>
|
|
2776
|
+
<div class="verdict">${result.comparison.siteAAdvantages.map((c) => escapeHtml(c)).join(", ")}</div>
|
|
2777
|
+
` : ""}
|
|
2778
|
+
|
|
2779
|
+
${result.comparison.siteBAdvantages.length > 0 ? `
|
|
2780
|
+
<h2 class="section-title">${domainB} Advantages</h2>
|
|
2781
|
+
<div class="verdict">${result.comparison.siteBAdvantages.map((c) => escapeHtml(c)).join(", ")}</div>
|
|
2782
|
+
` : ""}
|
|
2783
|
+
|
|
2784
|
+
${result.comparison.tied.length > 0 ? `
|
|
2785
|
+
<h2 class="section-title">Tied Criteria</h2>
|
|
2786
|
+
<div class="verdict">${result.comparison.tied.map((c) => escapeHtml(c)).join(", ")}</div>
|
|
2787
|
+
` : ""}
|
|
2788
|
+
|
|
2789
|
+
<div class="footer">Generated by AEORank - ${now}</div>
|
|
2790
|
+
</div>
|
|
2791
|
+
</body>
|
|
2792
|
+
</html>`;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
// src/compare.ts
|
|
2796
|
+
async function compare(domainA, domainB, options) {
|
|
2797
|
+
const [siteA, siteB] = await Promise.all([
|
|
2798
|
+
audit(domainA, options),
|
|
2799
|
+
audit(domainB, options)
|
|
2800
|
+
]);
|
|
2801
|
+
const criteria = [];
|
|
2802
|
+
const siteAAdvantages = [];
|
|
2803
|
+
const siteBAdvantages = [];
|
|
2804
|
+
const tied = [];
|
|
2805
|
+
for (let i = 0; i < siteA.scorecard.length; i++) {
|
|
2806
|
+
const a = siteA.scorecard[i];
|
|
2807
|
+
const b = siteB.scorecard[i];
|
|
2808
|
+
if (!a || !b) continue;
|
|
2809
|
+
const delta = a.score - b.score;
|
|
2810
|
+
criteria.push({
|
|
2811
|
+
id: a.id,
|
|
2812
|
+
criterion: a.criterion,
|
|
2813
|
+
scoreA: a.score,
|
|
2814
|
+
scoreB: b.score,
|
|
2815
|
+
delta,
|
|
2816
|
+
statusA: a.status,
|
|
2817
|
+
statusB: b.status
|
|
2818
|
+
});
|
|
2819
|
+
if (delta > 0) siteAAdvantages.push(a.criterion);
|
|
2820
|
+
else if (delta < 0) siteBAdvantages.push(a.criterion);
|
|
2821
|
+
else tied.push(a.criterion);
|
|
2822
|
+
}
|
|
2823
|
+
return {
|
|
2824
|
+
siteA,
|
|
2825
|
+
siteB,
|
|
2826
|
+
comparison: {
|
|
2827
|
+
scoreDelta: siteA.overallScore - siteB.overallScore,
|
|
2828
|
+
criteria,
|
|
2829
|
+
siteAAdvantages,
|
|
2830
|
+
siteBAdvantages,
|
|
2831
|
+
tied
|
|
2832
|
+
}
|
|
2833
|
+
};
|
|
2834
|
+
}
|
|
2512
2835
|
export {
|
|
2513
2836
|
CRITERION_LABELS,
|
|
2514
2837
|
analyzeAllPages,
|
|
@@ -2519,6 +2842,7 @@ export {
|
|
|
2519
2842
|
buildScorecard,
|
|
2520
2843
|
calculateOverallScore,
|
|
2521
2844
|
classifyRendering,
|
|
2845
|
+
compare,
|
|
2522
2846
|
detectParkedDomain,
|
|
2523
2847
|
extractContentPagesFromSitemap,
|
|
2524
2848
|
extractNavLinks,
|
|
@@ -2526,6 +2850,8 @@ export {
|
|
|
2526
2850
|
fetchMultiPageData,
|
|
2527
2851
|
fetchWithHeadless,
|
|
2528
2852
|
generateBottomLine,
|
|
2853
|
+
generateComparisonHtmlReport,
|
|
2854
|
+
generateHtmlReport,
|
|
2529
2855
|
generateOpportunities,
|
|
2530
2856
|
generatePitchNumbers,
|
|
2531
2857
|
generateVerdict,
|