Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/analyzers/entity-consistency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ export function analyzeEntityConsistency(context: AuditContext): AnalysisResult
recommendations.push('Standardize brand/entity naming in HTML metadata and JSON-LD.')
}

// Title length check — titles over 70 characters get truncated in search and AI citations
const rawTitle = (context.pageTitle || '').trim()
if (rawTitle.length > 0 && rawTitle.length <= 70) {
score += 10
findings.push({ type: 'found', message: `Page title is ${rawTitle.length} characters (within 70-char limit).` })
} else if (rawTitle.length > 70) {
findings.push({ type: 'info', message: `Page title is ${rawTitle.length} characters (exceeds 70-char limit).` })
recommendations.push('Shorten the page title to 70 characters or fewer to avoid truncation in AI citations.')
}

const canonicalHref = context.$('link[rel="canonical"]').attr('href')
if (canonicalHref) {
score += 20
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ test('compiled CLI returns the expected JSON report for the fixture site', async
{ id: 'faq-content', score: 82, grade: 'B-', status: 'pass' },
{ id: 'citations', score: 66, grade: 'D', status: 'partial' },
{ id: 'schema-completeness', score: 45, grade: 'F', status: 'partial' },
{ id: 'entity-consistency', score: 84, grade: 'B', status: 'pass' },
{ id: 'entity-consistency', score: 94, grade: 'A', status: 'pass' },
{ id: 'content-freshness', score: 82, grade: 'B-', status: 'pass' },
{ id: 'content-extractability', score: 48, grade: 'F', status: 'partial' },
{ id: 'definition-blocks', score: 100, grade: 'A+', status: 'pass' },
Expand Down
Loading