fix: correct links_without_text count and add overall score calculation
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
1. seo_analyzer.py: Consider aria-label, title, img AND svg as valid link text (SVG icon links were falsely counted as "without text") 2. routes_portal_seo.py: Calculate overall_seo score using SEOAuditor._calculate_overall_score() before saving to DB (was always None because stream route bypasses audit_company()) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0dbf9120c0
commit
b0befd2973
@ -489,6 +489,13 @@ def admin_portal_seo_run_stream():
|
||||
'status': 'error'
|
||||
})
|
||||
|
||||
# Calculate overall score (same algorithm as SEOAuditor)
|
||||
try:
|
||||
overall = auditor._calculate_overall_score(result)
|
||||
result['scores']['overall_seo'] = overall
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Step 9: Save to DB
|
||||
yield _sse_event({
|
||||
'step': 9, 'total': TOTAL,
|
||||
|
||||
@ -579,8 +579,15 @@ class OnPageSEOAnalyzer:
|
||||
result.broken_anchor_links += 1
|
||||
continue
|
||||
|
||||
# Check for links without text
|
||||
if not text and not anchor.find('img'):
|
||||
# Check for links without text (consider aria-label, title, img, svg)
|
||||
has_accessible_text = bool(
|
||||
text
|
||||
or anchor.get('aria-label')
|
||||
or anchor.get('title')
|
||||
or anchor.find('img')
|
||||
or anchor.find('svg')
|
||||
)
|
||||
if not has_accessible_text:
|
||||
result.links_without_text += 1
|
||||
|
||||
# Check for nofollow
|
||||
|
||||
Loading…
Reference in New Issue
Block a user