-
Notifications
You must be signed in to change notification settings - Fork 0
/
mydoc_search_configuration.html
946 lines (404 loc) · 35.5 KB
/
mydoc_search_configuration.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="The search feature uses JavaScript to look for keyword matches in a JSON file. The results show instant matches, but it doesn't provide a search results page...">
<meta name="keywords" content="publishingnavigation, search, json, configuration, findability">
<title>Search configuration | Jekyll theme for documentation</title>
<link rel="stylesheet" href="css/syntax.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">-->
<link rel="stylesheet" href="css/modern-business.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/customstyles.css">
<link rel="stylesheet" href="css/boxshadowproperties.css">
<!-- most color styles are extracted out to here -->
<link rel="stylesheet" href="css/theme-blue.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="js/jquery.navgoco.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- Anchor.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.2.0/anchor.min.js"></script>
<script src="js/toc.js"></script>
<script src="js/customscripts.js"></script>
<link rel="shortcut icon" href="images/favicon.ico">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="" href="http://localhost:4000/feed.xml">
<script>
$(document).ready(function() {
// Initialize navgoco with default options
$("#mysidebar").navgoco({
caretHtml: '',
accordion: true,
openClass: 'active', // open
save: false, // leave false or nav highlighting doesn't work right
cookie: {
name: 'navgoco',
expires: false,
path: '/'
},
slide: {
duration: 400,
easing: 'swing'
}
});
$("#collapseAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', false);
});
$("#expandAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', true);
});
});
</script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<script>
$(document).ready(function() {
$("#tg-sb-link").click(function() {
$("#tg-sb-sidebar").toggle();
$("#tg-sb-content").toggleClass('col-md-9');
$("#tg-sb-content").toggleClass('col-md-12');
$("#tg-sb-icon").toggleClass('fa-toggle-on');
$("#tg-sb-icon").toggleClass('fa-toggle-off');
});
});
</script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container topnavlinks">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="fa fa-home fa-lg navbar-brand" href="index.html"> <span class="projectTitle"> topnav_title</span></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<!-- toggle sidebar button -->
<li><a id="tg-sb-link" href="#"><i id="tg-sb-icon" class="fa fa-toggle-on"></i> Nav</a></li>
<!-- entries without drop-downs appear here -->
<li><a href="https://github.com/tomjoht/documentation-theme-jekyll" target="_blank" rel="noopener">GitHub</a></li>
<li><a href="news">News</a></li>
<!-- entries with drop-downs appear here -->
<!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Jekyll Help<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://talk.jekyllrb.com" target="_blank" rel="noopener">Jekyll Talk</a></li>
<li><a href="http://jekyllrb.com/docs/home/" target="_blank" rel="noopener">Jekyll documentation</a></li>
<li><a href="http://stackoverflow.com/questions/tagged/jekyll" target="_blank" rel="noopener">Jekyll on Stack Overflow</a></li>
<li><a href="http://idratherbewriting.com/category-jekyll/" target="_blank" rel="noopener">Jekyll on my blog</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Products<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="mydoc_introduction.html">Jekyll Documentation Theme</a></li>
<li><a href="p1_landing_page.html">Product 1</a></li>
<li><a href="p2_landing_page.html">Product 2</a></li>
</ul>
</li>
<li>
<a class="email" title="Submit feedback" href="#" onclick="javascript:window.location='mailto:tomjoht@gmail.com?subject=Jekyll documentation theme feedback&body=I have some feedback about the Search configuration page: ' + window.location.href;"><i class="fa fa-envelope-o"></i> Feedback</a>
</li>
<!--comment out this block if you want to hide search-->
<li>
<!--start search-->
<div id="search-demo-container">
<input type="text" id="search-input" placeholder="search...">
<ul id="results-container"></ul>
</div>
<script src="js/jekyll-search.js" type="text/javascript"></script>
<script type="text/javascript">
SimpleJekyllSearch.init({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
dataSource: 'search.json',
searchResultTemplate: '<li><a href="{url}" title="Search configuration">{title}</a></li>',
noResultsText: 'No results found.',
limit: 10,
fuzzy: true,
})
</script>
<!--end search-->
</li>
</ul>
</div>
</div>
<!-- /.container -->
</nav>
<!-- Page Content -->
<div class="container">
<div id="main">
<!-- Content Row -->
<div class="row">
<!-- Sidebar Column -->
<div class="col-md-3" id="tg-sb-sidebar">
<ul id="mysidebar" class="nav">
<li class="sidebarTitle">Jekyll Doc Theme 6.0</li>
<li>
<a title="Overview" href="#">Overview</a>
<ul>
<li><a title="Get started" href="index.html">Get started</a></li>
<li><a title="Introduction" href="mydoc_introduction.html">Introduction</a></li>
<li><a title="Supported features" href="mydoc_supported_features.html">Supported features</a></li>
<li><a title="About the theme author" href="mydoc_about.html">About the theme author</a></li>
<li><a title="Support" href="mydoc_support.html">Support</a></li>
</ul>
</li>
<li>
<a title="Release Notes" href="#">Release Notes</a>
<ul>
<li><a title="6.0 Release notes" href="mydoc_release_notes_60.html">6.0 Release notes</a></li>
<li><a title="5.0 Release notes" href="mydoc_release_notes_50.html">5.0 Release notes</a></li>
</ul>
</li>
<li>
<a title="Installation" href="#">Installation</a>
<ul>
<li><a title="About Ruby, Gems, Bundler, etc." href="mydoc_about_ruby_gems_etc.html">About Ruby, Gems, Bundler, etc.</a></li>
<li><a title="Install Jekyll on Mac" href="mydoc_install_jekyll_on_mac.html">Install Jekyll on Mac</a></li>
<li><a title="Install Jekyll on Windows" href="mydoc_install_jekyll_on_windows.html">Install Jekyll on Windows</a></li>
</ul>
</li>
<li>
<a title="Authoring" href="#">Authoring</a>
<ul>
<li><a title="Pages" href="mydoc_pages.html">Pages</a></li>
<li><a title="Posts" href="mydoc_posts.html">Posts</a></li>
<li><a title="Lists" href="mydoc_lists.html">Lists</a></li>
<li><a title="Conditional logic" href="mydoc_conditional_logic.html">Conditional logic</a></li>
<li><a title="Content reuse" href="mydoc_content_reuse.html">Content reuse</a></li>
<li><a title="Collections" href="mydoc_collections.html">Collections</a></li>
<li><a title="WebStorm editor tips" href="mydoc_webstorm_text_editor.html">WebStorm editor tips</a></li>
<li><a title="Atom editor tips" href="mydoc_atom_text_editor.html">Atom editor tips</a></li>
</ul>
</li>
<li>
<a title="Navigation" href="#">Navigation</a>
<ul>
<li><a title="Sidebar navigation" href="mydoc_sidebar_navigation.html">Sidebar navigation</a></li>
<li><a title="YAML tutorial in the context of Jekyll" href="mydoc_yaml_tutorial.html">YAML tutorial in the context of Jekyll</a></li>
<li><a title="Tags" href="mydoc_tags.html">Tags</a></li>
<li><a title="Series" href="mydoc_series.html">Series</a></li>
</ul>
</li>
<li>
<a title="Formatting" href="#">Formatting</a>
<ul>
<li><a title="Tooltips" href="mydoc_adding_tooltips.html">Tooltips</a></li>
<li><a title="Alerts" href="mydoc_alerts.html">Alerts</a></li>
<li><a title="Icons" href="mydoc_icons.html">Icons</a></li>
<li><a title="Images" href="mydoc_images.html">Images</a></li>
<li><a title="Code samples" href="mydoc_code_samples.html">Code samples</a></li>
<li><a title="Labels" href="mydoc_labels.html">Labels</a></li>
<li><a title="Links" href="mydoc_hyperlinks.html">Links</a></li>
<li><a title="Navtabs" href="mydoc_navtabs.html">Navtabs</a></li>
<li><a title="Tables" href="mydoc_tables.html">Tables</a></li>
<li><a title="Syntax highlighting" href="mydoc_syntax_highlighting.html">Syntax highlighting</a></li>
<li><a title="Workflow maps" href="mydoc_workflow_maps.html">Workflow maps</a></li>
</ul>
</li>
<li>
<a title="Handling reviews" href="#">Handling reviews</a>
<ul>
<li><a title="Commenting on files" href="mydoc_commenting_on_files.html">Commenting on files</a></li>
</ul>
</li>
<li>
<a title="Publishing" href="#">Publishing</a>
<ul>
<li><a title="Build arguments" href="mydoc_build_arguments.html">Build arguments</a></li>
<li><a title="Themes" href="mydoc_themes.html">Themes</a></li>
<li><a title="Generating PDFs" href="mydoc_generating_pdfs.html">Generating PDFs</a></li>
<li><a title="Help APIs and UI tooltips" href="mydoc_help_api.html">Help APIs and UI tooltips</a></li>
<li class="active"><a title="Search configuration" href="mydoc_search_configuration.html">Search configuration</a></li>
<li><a title="iTerm profiles" href="mydoc_iterm_profiles.html">iTerm profiles</a></li>
<li><a title="Pushing builds to server" href="mydoc_push_build_to_server.html">Pushing builds to server</a></li>
<li><a title="Publishing on Github Pages" href="mydoc_publishing_github_pages.html">Publishing on Github Pages</a></li>
</ul>
</li>
<li>
<a title="Special layouts" href="#">Special layouts</a>
<ul>
<li><a title="Knowledge-base layout" href="mydoc_kb_layout.html">Knowledge-base layout</a></li>
<li><a title="Glossary layout" href="mydoc_glossary.html">Glossary layout</a></li>
<li><a title="FAQ layout" href="mydoc_faq_layout.html">FAQ layout</a></li>
<li><a title="Shuffle layout" href="mydoc_shuffle.html">Shuffle layout</a></li>
</ul>
</li>
<li>
<a title="Troubleshooting" href="#">Troubleshooting</a>
<ul>
<li><a title="Troubleshooting" href="mydoc_troubleshooting.html">Troubleshooting</a></li>
</ul>
</li>
<li>
<a title="Tag archives" href="#">Tag archives</a>
<ul>
<li><a title="Tag archives overview" href="mydoc_tag_archives_overview.html">Tag archives overview</a></li>
<li class="subfolders">
<a title="Tag archive pages" href="#">Tag archive pages</a>
<ul>
<li><a title="Formatting pages" href="tag_formatting.html">Formatting pages</a></li>
<li><a title="Navigation pages" href="tag_navigation.html">Navigation pages</a></li>
<li><a title="Content types pages" href="tag_content_types.html">Content types pages</a></li>
<li><a title="Publishing pages" href="tag_publishing.html">Publishing pages</a></li>
<li><a title="Special layout pages" href="tag_special_layouts.html">Special layout pages</a></li>
<li><a title="Collaboration pages" href="tag_collaboration.html">Collaboration pages</a></li>
<li><a title="Troubleshooting pages" href="tag_troubleshooting.html">Troubleshooting pages</a></li>
</ul>
</li>
</ul>
</li>
<!-- if you aren't using the accordion, uncomment this block:
<p class="external">
<a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
</p>
-->
</ul>
<!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
<script>$("li.active").parents('li').toggleClass("active");</script>
</div>
<!-- Content Column -->
<div class="col-md-9" id="tg-sb-content">
<div class="post-header">
<h1 class="post-title-main">Search configuration</h1>
</div>
<div class="post-content">
<div class="summary">The search feature uses JavaScript to look for keyword matches in a JSON file. The results show instant matches, but it doesn't provide a search results page like Google. Also, sometimes invalid formatting can break the JSON file.</div>
<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
<script>
$( document ).ready(function() {
// Handler for .ready() called.
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
/* this offset helps account for the space taken up by the floating toolbar. */
$('#toc').on('click', 'a', function() {
var target = $(this.getAttribute('href'))
, scroll_target = target.offset().top
$(window).scrollTop(scroll_target - 10);
return false
})
});
</script>
<div id="toc"></div>
<a target="_blank" rel="noopener" href="https://github.com/tomjoht/documentation-theme-jekyll/blob/gh-pages/pages/mydoc/mydoc_search_configuration.md" class="btn btn-default githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>
<h2 id="about-search">About search</h2>
<p>The search is configured through the search.json file in the root directory. The search is a simple search that looks at content in pages. It looks at titles, summaries, keywords, and tags.</p>
<p>However, the search doesn’t work like google — you can’t hit return and see a list of results on the search results page, with the keywords in bold. Instead, this search shows a list of page titles that contain keyword matches. It’s fast, but simple.</p>
<h2 id="excluding-pages-from-search">Excluding pages from search</h2>
<p>By default, every page is included in the search. Depending on the type of content you’re including, you may find that some pages will break the JSON formatting. If that happens, then the search will no longer work.</p>
<p>If you want to exclude a page from search add <code class="language-plaintext highlighter-rouge">search: exclude</code> in the page’s frontmatter.</p>
<h2 id="troubleshooting-search">Troubleshooting search</h2>
<p>You should exclude any files from search that you don’t want appearing in the search results. For example, if you have a tooltips.json file or prince-list.txt, don’t include it, as the formatting will break the JSON format.</p>
<p>If any formatting in the search.json file is invalid (in the build), search won’t work. You’ll know that search isn’t working if no results appear when you start typing in the search box.</p>
<p>If this happens, point your browser to your build’s search.json file at http://localhost:4000/search.json (or your public github pages site), copy the entire search.json page as it’s output on the browser, and then use a <a href="http://jsonlint.com/">JSON validator</a> to validate the output by pasting what you copied into the validator. Look for the line causing trouble. It will be highlighted. Edit the file that’s causing the problem to either exclude it from the search or fix the syntax so that it doesn’t invalidate the JSON. (Note that tabs in the body will invalidate JSON, as will certain characters in the file’s front matter. For example, the summary: cannot have “ quotes in it.</p>
<p>The search.json file already tries to strip out content that would otherwise make the JSON invalid.</p>
<h2 id="including-the-body-field-in-search">Including the body field in search</h2>
<p>I’ve found that including the <code class="language-plaintext highlighter-rouge">body</code> field in the search creates too many problems, and so I’ve removed <code class="language-plaintext highlighter-rouge">body</code> from the search. You can see the results of including the <code class="language-plaintext highlighter-rouge">body</code> by adding this along with the other fields in search.json:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="w"> </span><span class="nl">"body"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{ page.content | strip_html | strip_newlines | replace: '</span><span class="se">\'</span><span class="s2">, '</span><span class="se">\\\\</span><span class="s2">' | replace: '"</span><span class="err">',</span><span class="w"> </span><span class="err">'\\</span><span class="s2">"' | replace: ' ', ' ' }}"</span><span class="err">,</span><span class="w">
</span></code></pre></div></div>
<p>Note that the last replace, <code class="language-plaintext highlighter-rouge">| replace: '^t', ' ' </code>, looks for any tab character and replaces it with four spaces. (Tab characters invalidate JSON.) If you run into other problematic formatting, you can use regex expressions to find and replace the content. See <a href="http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/regular_expressions.html">Regular Expressions</a> for details on finding and replacing code.</p>
<p>It’s possible that the formatting may not account for all the scenarios that would invalidate the JSON. (Sometimes it’s an extra comma after the last item that makes it invalid.)</p>
<p>Note that including the body in the search creates other problems as well. The search results show the most immediate matches in the JSON file. If several topics have matches for the keyword in the body, these matches might appear before other files that have matches in the title, summary, or keywords. This is because this simple search does not provide any weighting mechanisms for the content.</p>
<h2 id="customizing-search-results">Customizing search results</h2>
<p>At some point, you may want to customize the search results more. Here’s a little more detail that will be helpful. The search.json file retrieves various page values:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="err">---</span><span class="w">
</span><span class="err">title:</span><span class="w"> </span><span class="err">search</span><span class="w">
</span><span class="err">layout:</span><span class="w"> </span><span class="err">none</span><span class="w">
</span><span class="err">search:</span><span class="w"> </span><span class="err">exclude</span><span class="w">
</span><span class="err">---</span><span class="w">
</span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">for</span><span class="w"> </span><span class="err">page</span><span class="w"> </span><span class="err">in</span><span class="w"> </span><span class="err">site.pages</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">unless</span><span class="w"> </span><span class="err">page.search</span><span class="w"> </span><span class="err">==</span><span class="w"> </span><span class="s2">"exclude"</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{ page.title | escape }}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tags"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{ page.tags }}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"keywords"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{page.keywords}}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{ page.url | remove: "</span><span class="err">/</span><span class="s2">"}}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"summary"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{page.summary | strip }}"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">endunless</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">endfor</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">for</span><span class="w"> </span><span class="err">post</span><span class="w"> </span><span class="err">in</span><span class="w"> </span><span class="err">site.posts</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{ post.title | escape }}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tags"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{ post.tags }}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"keywords"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{post.keywords}}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{ post.url }}"</span><span class="p">,</span><span class="w">
</span><span class="nl">"summary"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{post.summary | strip }}"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">unless</span><span class="w"> </span><span class="err">forloop.last</span><span class="w"> </span><span class="err">%</span><span class="p">},{</span><span class="err">%</span><span class="w"> </span><span class="err">endunless</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">endfor</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span></code></pre></div></div>
<p>The _includes/topnav.html file then makes use of these values:</p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><li></span>
<span class="c"><!--start search--></span>
<span class="nt"><div</span> <span class="na">id=</span><span class="s">"search-demo-container"</span><span class="nt">></span>
<span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">id=</span><span class="s">"search-input"</span> <span class="na">placeholder=</span><span class="s">"search..."</span><span class="nt">></span>
<span class="nt"><ul</span> <span class="na">id=</span><span class="s">"results-container"</span><span class="nt">></ul></span>
<span class="nt"></div></span>
<span class="nt"><script </span><span class="na">src=</span><span class="s">"js/jekyll-search.js"</span> <span class="na">type=</span><span class="s">"text/javascript"</span><span class="nt">></script></span>
<span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span><span class="nt">></span>
<span class="nx">SimpleJekyllSearch</span><span class="p">.</span><span class="nx">init</span><span class="p">({</span>
<span class="na">searchInput</span><span class="p">:</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="dl">'</span><span class="s1">search-input</span><span class="dl">'</span><span class="p">),</span>
<span class="na">resultsContainer</span><span class="p">:</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="dl">'</span><span class="s1">results-container</span><span class="dl">'</span><span class="p">),</span>
<span class="na">dataSource</span><span class="p">:</span> <span class="dl">'</span><span class="s1">search.json</span><span class="dl">'</span><span class="p">,</span>
<span class="na">searchResultTemplate</span><span class="p">:</span> <span class="dl">'</span><span class="s1"><li><a href="{url}" title="Search configuration">{title}</a></li></span><span class="dl">'</span><span class="p">,</span>
<span class="na">noResultsText</span><span class="p">:</span> <span class="dl">'</span><span class="s1">No results found.</span><span class="dl">'</span><span class="p">,</span>
<span class="na">limit</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
<span class="na">fuzzy</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
<span class="p">})</span>
<span class="nt"></script></span>
<span class="c"><!--end search--></span>
<span class="nt"></li></span>
</code></pre></div></div>
<p>Where you see <code class="language-plaintext highlighter-rouge">{url}</code> and <code class="language-plaintext highlighter-rouge">{title}</code>, the search is retrieving the values for these as specified in the search.json file.</p>
<h2 id="more-robust-search">More robust search</h2>
<p>Overall, the built-in search only works for small documentation projects. If you have more robust search needs, consider integrating <a href="https://cse.google.com/cse/">Google Custom Search</a>, <a href="http://algolia.com">Algolia</a>, or <a href="http://swiftype.com">Swifttype</a>.</p>
<div class="tags">
<b>Tags: </b>
<a href="tag_publishing.html" class="btn btn-default navbar-btn cursorNorm" role="button">publishing</a>
<a href="tag_navigation.html" class="btn btn-default navbar-btn cursorNorm" role="button">navigation</a>
</div>
</div>
<hr class="shaded"/>
<footer>
<div class="row">
<div class="col-lg-12 footer">
©2022 Copyright 2021 Google LLC. All rights reserved. <br />
<span>Page last updated:</span> July 3, 2016<br/> Site last generated: Oct 15, 2022 <br />
<p><img src="images/company_logo.png" alt="Company logo"/></p>
</div>
</div>
</footer>
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</div>
<!-- /#main -->
</div>
</body>
</html>