-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.js
More file actions
1849 lines (1748 loc) · 77.2 KB
/
Copy pathbuild.js
File metadata and controls
1849 lines (1748 loc) · 77.2 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const fs = require('fs');
const path = require('path');
const OUT_DIR = path.join(process.cwd(), 'dist');
const ASSET_DIR = path.join(OUT_DIR, 'assets');
const CONTENT_DIR = path.join(process.cwd(), 'content');
const standaloneDocs = [];
const sections = [
{
slug: 'getting-started',
title: 'Getting Started',
description: 'Step-by-step onboarding for new teams.',
pages: [
'Setup Guide',
'Create an Account',
'Sign-in and SSO Options',
'Create Your First Brand',
'Describe Your Brand',
'Define Topics',
'Create Scenarios',
'Run Your First Conversations',
'Understanding Your First Results',
'Generating Personas from Documents',
'Customizing Your Dashboard',
'Topic Tags',
'Your First Week'
]
},
{
slug: 'introduction',
title: 'Introduction',
description: 'Understand AI Recommendations, Visibility, and how Genezio works.',
pages: [
'What is Genezio?',
'Why AI Recommendations Matter',
'How LLM Search Works',
'Query Fanouts Explained',
'How LLMs Select Sources',
'How AI Citations Work',
'What KPIs Are We Measuring',
'How Genezio Measures Visibility',
'How the 5 Agents Work'
]
},
{
slug: 'core-concepts',
title: 'Core Concepts',
description: 'Learn the core data model used across the platform.',
pages: [
'Brands',
'Brand Recommendation',
'Brand Visibility',
'Users',
'Personas',
'Topics',
'Scenarios',
'Topic / Scenario Relevance',
'Conversations',
'Query Fanouts',
'Citations',
'Perceptions',
'Competitors',
'Knowledge Base',
'Master Filters'
]
},
{
slug: 'genezio-agents',
title: 'Genezio Agents',
description: 'Agent types used to run conversations in Genezio.',
pages: ['Prompter Agent', 'Recommender Agent', 'Introspector Agent', 'Comparer Agent', 'Fact Checker Agent']
},
{
slug: 'analysis',
title: 'Running Conversations',
description: 'Configure and run analysis workflows.',
pages: [
'Creating Scenarios',
'Selecting Answer Engines',
'Running Conversations',
'Sentiment Analysis',
'Playground'
]
},
{
slug: 'insights',
title: 'Insights',
description: 'Interpret metrics and translate them into decisions.',
pages: [
'Your KPIs Explained',
'AI Visibility Score',
'AI Perception Summary',
'Share of Voice',
'Competitor Insights',
'SWOT Analysis',
'Sentiment Analysis',
'Most Cited Sources',
'Content Opportunities',
'Actionable Insights'
]
},
{
slug: 'content-hub',
title: 'Content Hub',
description: 'Create and optimize source-worthy content.',
pages: [
'Content Hub',
'From Data to Content Strategy',
'Generating Articles',
'Briefs',
'Content Analyzer',
'Using Query Fanouts for Content',
'Selecting Tone of Voice',
'Selecting Target Audience',
'Editing Articles',
'Chatting with Your Article',
'Publishing Content'
]
},
{
slug: 'geo-assistant',
title: 'Geo Assistant',
description: 'Chat with your brand data — investigate, report, and decide what to do next.',
pages: [
'Geo Assistant',
'Send to Geo',
'Sessions and History',
'Actions Geo Can Take'
]
},
{
slug: 'improving-ai-visibility',
title: 'Improving AI Visibility',
description: 'Optimization strategy for GEO/AEO workflows.',
pages: [
'How LLMs Choose Sources',
'Entity Reinforcement',
'Structuring Content for LLMs',
'Semantic Topic Coverage',
'Building Authority',
'Backlinks and Citations',
'Updating Content',
'Monitoring AI Visibility'
]
},
{
slug: 'shopping',
title: 'Shopping',
description: 'Track how AI talks about your individual products.',
pages: [
'Product Visibility',
'Shopping Overview',
'Products',
'Product Details',
'Merchants and Retailers'
]
},
{
slug: 'agentic-commerce',
title: 'Agentic Commerce',
description: 'Make your store ready for AI shopping agents.',
pages: [
'Agentic Commerce Readiness',
'UCP Readiness Audit'
]
},
{
slug: 'dashboards',
title: 'Dashboards & Metrics',
description: 'Use dashboards to track movement over time.',
pages: [
'Visibility Score Explained',
'Share of Voice',
'Topic Performance',
'Scenario Performance',
'Citation Frequency',
'Competitor Comparison',
'Trend Tracking'
]
},
{
slug: 'integrations',
title: 'Integrations',
description: 'Connect Genezio with your analytics stack.',
pages: [
'Google Analytics Integration',
'CDN Log Integration',
'Data Exports',
'Webhooks',
'External Reporting Tools'
]
},
{
slug: 'api',
title: 'API Documentation',
description: 'Programmatic access for agencies and technical teams.',
pages: [
'Authentication',
'Run Conversations API',
'Query Fanouts API',
'Citations API',
'Insights API',
'Rate Limits',
'Example Requests',
'SDK Examples'
]
},
{
slug: 'security',
title: 'Security & Data',
description: 'Security, governance, and compliance policies.',
pages: [
'Enterprise SSO and SCIM',
'Data Collection',
'Privacy',
'Security Architecture',
'Certifications',
'Data Retention',
'Compliance'
]
},
{
slug: 'tutorials',
title: 'Tutorials',
description: 'End-to-end guides for real team workflows.',
pages: [
'Improve AI Visibility for an Ecommerce Brand',
'Improve AI Visibility for a SaaS Company',
'Track Competitors in AI Search',
'Generate Content That LLMs Cite',
'Monitor Brand Reputation in AI'
]
},
{
slug: 'faq',
title: 'FAQ',
description: 'Common questions and troubleshooting.',
pages: [
'How often should I run conversations?',
'Why do LLM results change?',
'Why is my brand not cited?',
'How does Genezio detect competitors?',
'How accurate are AI visibility scores?'
]
}
];
const quickLinks = [];
let enabledSections = [];
let enabledStandaloneDocs = [];
const PARTIAL_SECTIONS = new Set(['insights', 'content-hub']);
const PAGE_OVERRIDES = {
'introduction::What is Genezio?': {
summary:
'Genezio is an AI Visibility platform that helps brands measure and improve how they are mentioned, recommended, cited, and positioned inside AI-generated answers.',
goals: [
'Understand the shift from traditional search rankings to AI answer visibility.',
'Map AI visibility signals to marketing outcomes: mention share, recommendation rate, and citation quality.',
'Use Genezio as an operating system for weekly optimization, not only a report.'
],
workflow: [
'Pick one brand and one market as your initial scope.',
'Run baseline conversations across your highest-intent topics.',
'Review mentions, citations, competitors, and statements together.',
'Convert findings into a weekly optimization backlog.'
]
},
'introduction::What is AI Visibility?': {
summary:
'AI Visibility is the degree to which your brand appears and is positioned well in LLM answers when users ask decision-making questions.',
goals: [
'Differentiate AI visibility from classic SEO rank tracking.',
'Track the right outcomes: mentions, recommendations, citations, sentiment, and share of voice.',
'Set baseline metrics that can be improved week over week.'
],
workflow: [
'Choose one product category and one audience segment.',
'Define 20-40 high-intent scenarios users actually ask.',
'Measure current mention and recommendation frequency.',
'Prioritize the top gaps where your brand is missing or mispositioned.'
]
},
'introduction::How LLM Search Works': {
summary:
'LLMs convert conversation context into internal web queries, retrieve sources, then synthesize recommendations from those sources and model priors.',
goals: [
'Understand why AI responses vary by prompt context, persona, and location.',
'See how internal LLM search queries affect citations and recommendations.',
'Translate LLM query behavior into content planning decisions.'
],
workflow: [
'Start from one real buyer question.',
'Inspect the fanout queries triggered by that question.',
'Review which sources are cited and which competitors are surfaced.',
'Update your content plan based on repeated high-value query patterns.'
]
},
'introduction::Query Fanouts Explained': {
summary:
'Query fanouts are the multiple hidden searches an LLM performs to answer one user question, especially in complex comparison and recommendation prompts.',
goals: [
'Understand why a single conversation can trigger many search intents.',
'Use fanouts to discover the exact questions AI systems try to answer.',
'Identify which fanouts lead to competitor wins versus brand wins.'
],
workflow: [
'Run conversations with multi-turn follow-ups.',
'Extract fanouts for each turn and group by intent.',
'Match fanouts to resulting citations and statements.',
'Prioritize content creation for high-frequency fanouts where your brand is absent.'
]
},
'introduction::How LLMs Select Sources': {
summary:
'LLMs select sources based on relevance, perceived authority, freshness, and contextual fit for persona and geography.',
goals: [
'See why authoritative third-party domains often shape AI answers.',
'Understand how language and location alter source selection.',
'Design pages and evidence assets that are easier for LLMs to trust and cite.'
],
workflow: [
'Identify your most cited third-party and competitor domains.',
'Audit missing first-party pages for key decision questions.',
'Publish clearer comparison, pricing, and proof-focused content.',
'Rerun analysis and track first-party citation lift.'
]
},
'introduction::How AI Citations Work': {
summary:
'AI citations are the visible output of hidden LLM search behavior and strongly influence the credibility of recommendations.',
goals: [
'Track first-party versus third-party citation share.',
'Find negative or outdated citations influencing brand perception.',
'Use citation-level data to guide PR, SEO, and content updates.'
],
workflow: [
'Review citation domains by frequency and sentiment.',
'Classify citations as first-party, partner, competitor, or independent media.',
'Correct outdated claims in high-impact sources.',
'Measure whether citation quality and recommendation rate improve.'
]
},
'introduction::How Genezio Measures Visibility': {
summary:
'Genezio measures visibility by running persona-aware, location-aware conversations across models and extracting mentions, citations, competitors, statements, and sentiment.',
goals: [
'Understand the difference between one-shot prompt testing and conversation-based measurement.',
'Learn why persona and geography are mandatory dimensions for reliable analysis.',
'Connect extracted signals to a repeatable weekly decision process.'
],
workflow: [
'Define brand, persona, topics, and scenarios.',
'Run conversations across selected LLMs.',
'Analyze extracted entities and trends by topic and persona.',
'Ship one optimization sprint and compare against baseline.'
]
},
'getting-started::Run Your First Conversations': {
summary:
'Your first run should simulate realistic customer dialogue, not isolated prompts. Use persona-specific and location-specific setup before execution.',
goals: [
'Run a first conversation set that reflects real customer decision paths.',
'Validate mention, citation, and competitor extraction quality.',
'Establish a baseline snapshot for future optimization.'
],
workflow: [
'Select one topic with clear commercial intent.',
'Attach a realistic persona (role, constraints, region, language).',
'Run a multi-turn conversation with follow-up constraints.',
'Inspect citation and competitor changes across turns.'
],
metrics: ['Run completion rate', 'Extracted entities per run', 'Baseline recommendation rate']
},
'getting-started::Create an Account': {
summary:
'Create your account and define the ownership model early so governance stays clean as more teams join.',
goals: [
'Choose the right account type for brand or agency use.',
'Set secure access defaults from day one.',
'Prepare your workspace for scalable onboarding.'
],
workflow: [
'Sign up with your primary company identity provider.',
'Confirm owner access and backup admin ownership.',
'Enable baseline security settings and invite core users only.',
'Document who is responsible for brand-level access decisions.'
],
metrics: ['Time to account activation', 'Owner assignment completeness', 'Security setup completion']
},
'getting-started::Create Your First Brand': {
summary:
'Set up one brand with clear naming, website scope, and market boundaries to avoid noisy analysis.',
goals: [
'Define a brand entity that maps to real market perception.',
'Avoid overlap between product lines during initial setup.',
'Create a stable anchor for all future reporting.'
],
workflow: [
'Add official brand name and canonical website domain.',
'Set primary region and language for first analysis cycle.',
'Add concise brand description with core value proposition.',
'Validate brand scope with marketing and product stakeholders.'
],
metrics: ['Brand setup completeness', 'Scope clarity score', 'Stakeholder sign-off status']
},
'getting-started::Describe Your Brand': {
summary:
'A precise brand description improves scenario generation quality and helps models evaluate your brand in the right context.',
goals: [
'Document core positioning in clear, non-promotional language.',
'Capture differentiators that matter in comparisons.',
'Align description with current GTM and target customer.'
],
workflow: [
'Write a short brand statement focused on real customer value.',
'Add category terms, use cases, and key differentiators.',
'Include constraints honestly (price tier, region, integrations).',
'Review for clarity and remove vague marketing claims.'
],
metrics: ['Description completeness', 'Scenario relevance quality', 'Positioning consistency']
},
'getting-started::Define Topics': {
summary:
'Topics should mirror business priorities and buyer intent, not internal org charts or campaign labels.',
goals: [
'Build a balanced topic set across discovery, comparison, and decision intents.',
'Attach each topic to a realistic persona.',
'Prioritize topics with measurable business impact.'
],
workflow: [
'List your top decision questions from sales and support teams.',
'Group questions into 5-10 strategic topic clusters.',
'Assign one primary persona and geography to each topic.',
'Rank topics by revenue impact and urgency.'
],
metrics: ['Topics with persona assigned', 'Topic priority coverage', 'Intent balance score']
},
'getting-started::Create Scenarios': {
summary:
'Scenarios should sound like real buyer questions, including constraints and follow-ups that influence recommendations.',
goals: [
'Write scenarios that trigger realistic model reasoning.',
'Cover both branded and non-branded entry points.',
'Include multi-turn paths for deeper evaluation.'
],
workflow: [
'Draft scenario prompts from customer call transcripts and FAQs.',
'Include explicit constraints (team size, budget, location, stack).',
'Add at least one follow-up turn per high-value scenario.',
'Remove leading language that biases outcome toward your brand.'
],
metrics: ['Scenario quality score', 'Multi-turn coverage', 'Constraint completeness']
},
'getting-started::Understanding Your First Results': {
summary:
'First results should be treated as a baseline map of current AI perception, not as a final performance verdict.',
goals: [
'Interpret early outputs without overreacting to single-run variance.',
'Identify top gaps in mentions, citations, and narrative framing.',
'Turn baseline findings into a 7-day action plan.'
],
workflow: [
'Review visibility, citation, and competitor summaries by topic.',
'Flag repeated negative statements or missing recommendations.',
'Pick 3 high-impact fixes across content, SEO, and PR.',
'Schedule a rerun after implementation to measure movement.'
],
metrics: ['Baseline gap count', 'Action items created', 'Rerun delta after first sprint']
},
'core-concepts::Personas': {
summary:
'Personas define who is asking and from where, so analysis reflects real buyer context, language, and geography instead of generic prompt tests.',
goals: [
'Model realistic decision criteria and objections for each customer type.',
'Use location and language as first-class analysis dimensions.',
'Compare how recommendations change across personas.'
]
},
'core-concepts::Topics': {
summary:
'Topics are strategic analysis units grouping scenarios around one intent area. Use explorer, introspector, comparer, and recommender patterns.',
goals: [
'Choose topic type based on objective: market scan, brand introspection, comparison, or decision recommendation.',
'Ensure each topic is tied to a defined persona.',
'Track performance at topic level before drilling into individual scenarios.'
]
},
'core-concepts::Conversations': {
summary:
'Conversations are stateful, multi-turn interactions where brand perception evolves as constraints are introduced.',
goals: [
'Understand why multi-turn flows are more realistic than one-shot prompts.',
'Track when competitors enter or exit the recommendation set.',
'Analyze which follow-up constraints change final outcomes.'
]
},
'core-concepts::Competitors': {
summary:
'Competitors are discovered from actual AI answers after execution, then normalized and editable for stable analytics.',
goals: [
'Use auto-discovery to identify AI-native competitors you did not predefine.',
'Normalize naming variants to avoid fragmented share-of-voice.',
'Track competitor movement by persona and geography.'
]
},
'analysis::Detecting Citations': {
summary:
'Citations explain why the model says what it says. Track URL/domain frequency, first-party vs third-party split, and sentiment of cited content.',
goals: [
'Identify domains shaping AI perception of your brand.',
'Find high-impact citations with negative or outdated framing.',
'Prioritize source updates and outreach by citation influence.'
]
},
'analysis::Extracting Query Fanouts': {
summary:
'Query fanouts reveal the hidden internal search questions LLMs generate while reasoning through a response.',
goals: [
'Observe AI-native long-form query patterns by intent.',
'Map each query to resulting citations and competitor mentions.',
'Use fanouts as direct input for content and FAQ roadmaps.'
]
},
'analysis::Sentiment Analysis': {
summary:
'Sentiment in Genezio covers both model statements and cited-source framing, helping teams detect narrative risk early.',
goals: [
'Separate product sentiment shifts from citation-source sentiment shifts.',
'Detect recurring negative caveats in recommendation contexts.',
'Define remediation actions tied to specific statements and sources.'
]
},
'api::Run Conversations API': {
summary:
'The Conversations API allows technical teams and agencies to launch analysis runs programmatically at scale.',
workflow: [
'Authenticate with your API key.',
'Submit a run request with brand, persona, topic, and scenario IDs.',
'Poll run status and fetch extracted results (mentions, citations, statements).',
'Push normalized data into BI or client reporting pipelines.'
]
},
'security::Privacy': {
summary:
'Privacy controls should align with brand governance, client contracts, and regional compliance requirements across multi-brand workspaces.',
goals: [
'Define who can view which brand-level datasets.',
'Apply role-based access for agencies and client stakeholders.',
'Review data retention and deletion policies before broad rollout.'
]
}
};
function slugify(value) {
return value
.toLowerCase()
.replace(/[^a-z0-9\s-]/g, '')
.trim()
.replace(/\s+/g, '-')
.replace(/-+/g, '-');
}
function ensureDir(dir) {
fs.mkdirSync(dir, { recursive: true });
}
function writeFile(targetPath, content) {
ensureDir(path.dirname(targetPath));
fs.writeFileSync(targetPath, content, 'utf8');
}
function outPath(relativePath) {
return path.join(OUT_DIR, relativePath);
}
function toRelative(fromFile, toFile) {
return path.relative(path.dirname(fromFile), toFile).replace(/\\/g, '/');
}
function escapeHtml(text) {
return text
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
function renderInline(text) {
let escaped = escapeHtml(text);
escaped = escaped.replace(/`([^`]+)`/g, '<code>$1</code>');
escaped = escaped.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
escaped = escaped.replace(/\*([^*]+)\*/g, '<em>$1</em>');
escaped = escaped.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, label, href) => {
let normalizedHref = href;
const isExternal = /^(?:[a-z]+:|#|\/\/)/i.test(normalizedHref);
if (!isExternal) {
normalizedHref = normalizedHref.replace(/\.md(#.*)?$/i, '.html$1');
normalizedHref = normalizedHref.replace(/(^|\/)\d{2}-([a-z0-9-]+)\.html(#.*)?$/i, '$1$2.html$3');
}
return `<a href="${normalizedHref}">${label}</a>`;
});
return escaped;
}
function markdownToHtml(markdown) {
const lines = markdown.replace(/\r\n/g, '\n').split('\n');
const out = [];
let paragraph = [];
let inCode = false;
let codeLang = '';
let codeLines = [];
let listType = null;
let quoteLines = [];
function flushParagraph() {
if (!paragraph.length) return;
out.push(`<p>${renderInline(paragraph.join(' '))}</p>`);
paragraph = [];
}
function closeList() {
if (!listType) return;
out.push(listType === 'ol' ? '</ol>' : '</ul>');
listType = null;
}
function flushQuote() {
if (!quoteLines.length) return;
const raw = quoteLines.join(' ').trim();
const normalized = raw
.replace(/\*\*/g, '')
.replace(/\*/g, '')
.trim()
.toLowerCase();
let cls = '';
if (normalized.startsWith('user query:')) cls = ' class="user-question"';
else if (normalized.startsWith('query fanout:')) cls = ' class="query-fanout"';
else if (normalized.startsWith('ai answer:')) cls = ' class="ai-answer"';
out.push(`<blockquote${cls}><p>${renderInline(raw)}</p></blockquote>`);
quoteLines = [];
}
function splitTableCells(line) {
let value = line.trim();
if (value.startsWith('|')) value = value.slice(1);
if (value.endsWith('|')) value = value.slice(0, -1);
if (!value.length) return [];
return value.split('|').map((cell) => cell.trim());
}
function isTableSeparator(line) {
const cells = splitTableCells(line);
if (cells.length === 0) return false;
return cells.every((cell) => /^:?-{3,}:?$/.test(cell));
}
function alignmentFromSeparator(cell) {
const left = cell.startsWith(':');
const right = cell.endsWith(':');
if (left && right) return 'center';
if (right) return 'right';
return 'left';
}
for (let i = 0; i < lines.length; i += 1) {
const line = lines[i];
const fence = line.match(/^```([\w-]+)?\s*$/);
if (fence) {
flushParagraph();
closeList();
if (!inCode) {
inCode = true;
codeLang = fence[1] || '';
codeLines = [];
} else {
const codeText = codeLines.join('\n');
const langClass = codeLang ? ` class="language-${escapeHtml(codeLang)}"` : '';
out.push(`<pre><code${langClass}>${escapeHtml(codeText)}</code></pre>`);
inCode = false;
codeLang = '';
codeLines = [];
}
continue;
}
if (inCode) {
codeLines.push(line);
continue;
}
if (!line.trim()) {
flushParagraph();
closeList();
flushQuote();
continue;
}
const nextLine = lines[i + 1] || '';
if (line.includes('|') && isTableSeparator(nextLine)) {
flushParagraph();
closeList();
flushQuote();
const headers = splitTableCells(line);
const alignments = splitTableCells(nextLine).map(alignmentFromSeparator);
out.push('<table>');
out.push(
`<thead><tr>${headers
.map((cell, idx) => `<th style="text-align:${alignments[idx] || 'left'}">${renderInline(cell)}</th>`)
.join('')}</tr></thead>`
);
out.push('<tbody>');
i += 2;
while (i < lines.length) {
const rowLine = lines[i];
if (!rowLine.trim() || !rowLine.includes('|')) break;
const cells = splitTableCells(rowLine);
if (cells.length === 0) break;
out.push(
`<tr>${cells
.map((cell, idx) => `<td style="text-align:${alignments[idx] || 'left'}">${renderInline(cell)}</td>`)
.join('')}</tr>`
);
i += 1;
}
out.push('</tbody>');
out.push('</table>');
i -= 1;
continue;
}
const hr = line.match(/^\s*([-*_])\1\1+\s*$/);
if (hr) {
flushParagraph();
closeList();
flushQuote();
out.push('<hr />');
continue;
}
const heading = line.match(/^(#{1,6})\s+(.+)$/);
if (heading) {
flushParagraph();
closeList();
flushQuote();
const level = heading[1].length;
const headingId = slugify(heading[2].replace(/[*`_]/g, ''));
const idAttr = headingId ? ` id="${headingId}"` : '';
out.push(`<h${level}${idAttr}>${renderInline(heading[2])}</h${level}>`);
continue;
}
const ulItem = line.match(/^(?:-|\*)\s+(.+)$/);
if (ulItem) {
flushParagraph();
flushQuote();
if (listType && listType !== 'ul') closeList();
if (!listType) {
listType = 'ul';
out.push('<ul>');
}
const taskMatch = ulItem[1].match(/^\[( |x|X)\]\s+(.+)$/);
if (taskMatch) {
const checked = taskMatch[1].toLowerCase() === 'x';
out.push(
`<li class="task-item"><label><input type="checkbox" disabled${checked ? ' checked' : ''} /> <span>${renderInline(
taskMatch[2]
)}</span></label></li>`
);
} else {
out.push(`<li>${renderInline(ulItem[1])}</li>`);
}
continue;
}
const olItem = line.match(/^\d+\.\s+(.+)$/);
if (olItem) {
flushParagraph();
flushQuote();
if (listType && listType !== 'ol') closeList();
if (!listType) {
listType = 'ol';
out.push('<ol>');
}
out.push(`<li>${renderInline(olItem[1])}</li>`);
continue;
}
const quote = line.match(/^\s*>\s?(.*)$/);
if (quote) {
flushParagraph();
closeList();
quoteLines.push(quote[1]);
continue;
}
closeList();
flushQuote();
paragraph.push(line.trim());
}
flushParagraph();
closeList();
flushQuote();
return out.join('\n');
}
function contentPath(...segments) {
return path.join(CONTENT_DIR, ...segments);
}
function ensureMarkdownFile(filePath) {
ensureDir(path.dirname(filePath));
if (!fs.existsSync(filePath)) {
fs.writeFileSync(filePath, '', 'utf8');
}
}
function readMarkdownFile(filePath) {
if (!fs.existsSync(filePath)) return '';
return fs.readFileSync(filePath, 'utf8');
}
function hasMarkdownContent(filePath) {
return readMarkdownFile(filePath).trim().length > 0;
}
function sectionLandingHref(section) {
if (section.hasIndex) return `${section.slug}/index.html`;
if (section.pages.length > 0) return `${section.slug}/${slugify(section.pages[0])}.html`;
return `${section.slug}/index.html`;
}
function computeEnabledStructure() {
enabledStandaloneDocs = standaloneDocs.filter((doc) => hasMarkdownContent(contentPath('docs', `${doc.slug}.md`)));
enabledSections = sections
.map((section) => {
const hasIndex = hasMarkdownContent(contentPath('docs', section.slug, 'index.md'));
const pages = section.pages.filter((pageTitle) =>
hasMarkdownContent(contentPath('docs', section.slug, `${slugify(pageTitle)}.md`))
);
if (!hasIndex && pages.length === 0) return null;
return { ...section, hasIndex, pages };
})
.filter(Boolean);
}
function buildSidebar(currentSection, currentPageSlug, currentFilePath) {
const standaloneLinks = enabledStandaloneDocs
.map((doc) => {
const href = toRelative(currentFilePath, outPath(`${doc.slug}.html`));
const activeClass = currentSection === doc.slug && currentPageSlug === '__single__' ? 'active' : '';
return `<section class="nav-group"><h3><a class="${activeClass}" href="${href}">${escapeHtml(doc.title)}</a></h3></section>`;
})
.join('');
function renderSectionGroup(section) {
const sectionHref = toRelative(currentFilePath, outPath(sectionLandingHref(section)));
const sectionActive = section.slug === currentSection;
const pageLinks = section.pages
.map((pageTitle) => {
const pageSlug = slugify(pageTitle);
const pagePath = `${section.slug}/${pageSlug}.html`;
const href = toRelative(currentFilePath, outPath(pagePath));
const activeClass = section.slug === currentSection && pageSlug === currentPageSlug ? 'active' : '';
return `<li><a class="${activeClass}" href="${href}">${escapeHtml(pageTitle)}</a></li>`;
})
.join('');
return `<section class="nav-group">
<h3><a class="${sectionActive ? 'active' : ''}" href="${sectionHref}">${escapeHtml(section.title)}</a></h3>
<ul>${pageLinks}</ul>
</section>`;
}
const actionSlugs = new Set(['insights', 'content-hub']);
const actionSections = enabledSections.filter((section) => actionSlugs.has(section.slug));
const regularSections = enabledSections.filter((section) => !actionSlugs.has(section.slug));
const regularNavBlocks = regularSections
.map((section) => renderSectionGroup(section))
.join('');
const actionGroup = actionSections.length
? `<section class="nav-group">
<h3>Actions</h3>
<ul>${actionSections
.flatMap((section) =>
section.pages.map((pageTitle) => {
const pageSlug = slugify(pageTitle);
const pagePath = `${section.slug}/${pageSlug}.html`;
const href = toRelative(currentFilePath, outPath(pagePath));
const activeClass = section.slug === currentSection && pageSlug === currentPageSlug ? 'active' : '';
return `<li><a class="${activeClass}" href="${href}">${escapeHtml(pageTitle)}</a></li>`;
})
)
.join('')}</ul>
</section>`
: '';
return `<aside class="sidebar" aria-label="Documentation navigation">
<div class="sidebar-header">
<span class="sidebar-title">Genezio Docs</span>
<hr style="border:none;border-top:1px solid var(--line);margin:12px 0 0" />
</div>
<div class="sidebar-nav">
${standaloneLinks}
${regularNavBlocks}
${actionGroup}
</div>
</aside>`;
}
const DEMO_URL = 'https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ30EAVu1QPRbggnIoR502OSYQwgn_fnBZYKo6AoZsu8ApjuqBdq59VHOxs3AsynJnOz1_G-kHnC';
function siteHeader() {
return `<header class="topbar">
<div class="topbar-inner">
<a class="brand" href="/" aria-label="Genezio Homepage"><img class="brand-logo" src="/images/logo-white.svg" alt="Genezio" /></a>
<nav class="topbar-nav" aria-label="Main navigation">
<div class="nav-item" data-dropdown>
<button class="nav-trigger" type="button" data-dropdown-trigger>Platform <i data-lucide="chevron-down" class="nav-chevron"></i></button>
<div class="nav-menu nav-menu-platform">
<div class="nav-menu-grid">
<div class="menu-col">
<div class="menu-col-label">For Teams</div>
<a class="menu-tile" href="/conversational-brand-presence/">
<div class="menu-ico emerald"><i data-lucide="trending-up"></i></div>
<div class="menu-text"><div class="menu-tt">Increase Lead Generation</div><div class="menu-st">Conversational Brand Presence</div></div>
</a>
<a class="menu-tile" href="/increase-conversion/">
<div class="menu-ico blue"><i data-lucide="target"></i></div>
<div class="menu-text"><div class="menu-tt">Increase Conversion</div><div class="menu-st">Marketing Agent Performance</div></div>
</a>
<a class="menu-tile" href="#">
<div class="menu-ico purple"><i data-lucide="shopping-bag"></i></div>
<div class="menu-text"><div class="menu-tt">Increase In-Chat Shopping <span class="menu-badge">COMING SOON</span></div><div class="menu-st">E-commerce Performance</div></div>
</a>
</div>
<div class="menu-col partners">
<div class="menu-col-label">Partners</div>
<a class="partner-card" href="/agencies/">
<div class="menu-tile" style="padding:0">
<div class="menu-ico agency"><i data-lucide="users"></i></div>
<div class="menu-text"><div class="menu-tt">For Agencies</div><div class="menu-st">Manage multiple brands effortlessly</div></div>
</div>
<div class="partner-rows">
<div class="partner-row"><div class="partner-chip"><span class="partner-dot"></span>Brand A</div><span class="partner-delta">↑ 24%</span></div>
<div class="partner-row"><div class="partner-chip"><span class="partner-dot"></span>Brand B</div><span class="partner-delta">↑ 18%</span></div>
<div class="partner-row"><div class="partner-chip"><span class="partner-dot"></span>Brand C</div><span class="partner-delta">↑ 31%</span></div>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="nav-item" data-dropdown>
<button class="nav-trigger" type="button" data-dropdown-trigger>Resources <i data-lucide="chevron-down" class="nav-chevron"></i></button>
<div class="nav-menu nav-menu-resources">
<a class="menu-tile" href="/docs/">
<div class="menu-ico cyan"><i data-lucide="book-marked"></i></div>
<div class="menu-text"><div class="menu-tt">Docs</div><div class="menu-st">Product documentation & guides</div></div>
</a>
<a class="menu-tile" href="/glossary/">
<div class="menu-ico blue"><i data-lucide="book-open"></i></div>
<div class="menu-text"><div class="menu-tt">Glossary</div><div class="menu-st">AI Search terminology guide</div></div>
</a>
<a class="menu-tile" href="/blog/">
<div class="menu-ico emerald"><i data-lucide="file-text"></i></div>
<div class="menu-text"><div class="menu-tt">Blog</div><div class="menu-st">Insights & best practices</div></div>
</a>
<a class="menu-tile" href="/research/">
<div class="menu-ico violet"><i data-lucide="flask-conical"></i></div>
<div class="menu-text"><div class="menu-tt">Research</div><div class="menu-st">Original AI search studies</div></div>
</a>
<a class="menu-tile" href="/industry-leaderboards">
<div class="menu-ico amber"><i data-lucide="trophy"></i></div>
<div class="menu-text"><div class="menu-tt">Leaderboards</div><div class="menu-st">Industry AI visibility rankings</div></div>
</a>
</div>
</div>
<a class="nav-link" href="/pricing/">Pricing</a>
</nav>
<div class="topbar-cta">
<a class="btn-login" href="https://app.genezio.ai/sign-in">Login</a>
<a class="btn-demo" target="_blank" rel="noopener" href="${DEMO_URL}">Book a Demo</a>
</div>
<button class="topbar-burger" id="site-burger" type="button" aria-label="Open menu"><i data-lucide="menu"></i></button>