-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvalidate-geo-optimization.js
More file actions
130 lines (105 loc) · 3.18 KB
/
Copy pathvalidate-geo-optimization.js
File metadata and controls
130 lines (105 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env node
/**
* GEO Optimization Validation Script
* Validates that all service pages follow GEO-friendly patterns
*/
const fs = require('fs');
const path = require('path');
// Service pages to validate
const servicePages = [
'app/services/web-development/page.tsx',
'app/services/av-systems/page.tsx',
'app/services/devops/page.tsx',
'app/about/page.tsx',
'app/faq/page.tsx'
];
// GEO validation patterns
const validationPatterns = {
citationFriendlyDefinition: /CitationBlock.*variant="definition"/,
citationFriendlySummary: /"In summary,/,
microFAQSection: /MicroFAQSection/,
serviceSection: /ServiceSection/,
exampleCard: /ExampleCard|ExampleGrid/,
relevanceExplanation: /relevanceExplanation/,
structuredData: /@context.*schema\.org/,
whenNotToChoose: /When.*NOT.*appropriate|When this service is NOT/,
bulletList: /BulletList/,
finalOutputFormat: /Final Output Format/
};
function validateFile(filePath) {
console.log(`\n🔍 Validating: ${filePath}`);
if (!fs.existsSync(filePath)) {
console.log(`❌ File not found: ${filePath}`);
return false;
}
const content = fs.readFileSync(filePath, 'utf8');
const results = {};
let allPassed = true;
// Check each pattern
for (const [pattern, regex] of Object.entries(validationPatterns)) {
const found = regex.test(content);
results[pattern] = found;
if (found) {
console.log(`✅ ${pattern}`);
} else {
console.log(`❌ ${pattern}`);
allPassed = false;
}
}
return allPassed;
}
function validateComponents() {
console.log('\n🔧 Validating GEO Components...');
const components = [
'components/citation-block.tsx',
'components/service-section.tsx',
'components/example-card.tsx',
'components/micro-faq-section.tsx'
];
let allExist = true;
for (const component of components) {
if (fs.existsSync(component)) {
console.log(`✅ ${component}`);
} else {
console.log(`❌ ${component}`);
allExist = false;
}
}
return allExist;
}
function main() {
console.log('🚀 Starting GEO Optimization Validation...\n');
// Validate components first
const componentsValid = validateComponents();
// Validate service pages
let allPagesValid = true;
for (const page of servicePages) {
const pageValid = validateFile(page);
if (!pageValid) {
allPagesValid = false;
}
}
// Final summary
console.log('\n📊 VALIDATION SUMMARY');
console.log('='.repeat(50));
if (componentsValid) {
console.log('✅ All GEO components exist');
} else {
console.log('❌ Some GEO components missing');
}
if (allPagesValid) {
console.log('✅ All service pages follow GEO patterns');
} else {
console.log('❌ Some service pages missing GEO patterns');
}
const overallValid = componentsValid && allPagesValid;
if (overallValid) {
console.log('\n🎉 GEO OPTIMIZATION VALIDATION PASSED!');
console.log('All service pages follow GEO-friendly patterns.');
} else {
console.log('\n⚠️ GEO OPTIMIZATION VALIDATION FAILED!');
console.log('Some requirements are not met. Check the details above.');
}
process.exit(overallValid ? 0 : 1);
}
main();