1
1
---
2
2
layout: main
3
3
---
4
- < link rel ="
stylesheet "
href ="
https://cdn.jsdelivr.net/npm/[email protected] /themes/satellite-min.css "
integrity ="
sha256-TehzF/2QvNKhGQrrNpoOb2Ck4iGZ1J/DI4pkd2oUsBc= "
crossorigin ="
anonymous "
>
4
+ < link rel ="
stylesheet "
href ="
https://cdn.jsdelivr.net/npm/[email protected] /themes/satellite-min.css "
5
+ integrity ="sha256-TehzF/2QvNKhGQrrNpoOb2Ck4iGZ1J/DI4pkd2oUsBc= " crossorigin ="anonymous ">
5
6
6
7
< main class ="docs__body stage__body ">
7
8
< div class ="docs__navbar ">
11
12
< div class ="field field--expand field--icon ">
12
13
< div id ="autocomplete "> </ div >
13
14
{% unless include.mobile %}
14
- < div class ="field__icon field__icon--right flex flex--middle flex--center ">
15
- < button class ="field__button " data-ref ="search-navbar[trigger] ">
16
- {% include icons/symbols/cross.svg %}
17
- </ button >
18
- </ div >
15
+ < div class ="field__icon field__icon--right flex flex--middle flex--center ">
16
+ < button class ="field__button " data-ref ="search-navbar[trigger] ">
17
+ {% include icons/symbols/cross.svg %}
18
+ </ button >
19
+ </ div >
19
20
{% endunless %}
20
21
</ div >
21
22
</ div >
34
35
{% include components/breadcrumbs.html %}
35
36
36
37
{%- if page.title -%}
37
- < h1 id ="{{ page.title | slugify }} ">
38
- {{ page.title }}
39
- </ h1 >
38
+ < h1 id ="{{ page.title | slugify }} ">
39
+ {{ page.title }}
40
+ </ h1 >
40
41
{%- endif -%}
41
42
42
43
< div class ="markdown " data-headings-anchors >
@@ -45,8 +46,8 @@ <h1 id="{{ page.title | slugify }}">
45
46
46
47
47
48
{% unless page.hide-feedback %}
48
- < hr >
49
- {% include components/feedback.html %}
49
+ < hr >
50
+ {% include components/feedback.html %}
50
51
{% endunless %}
51
52
52
53
< hr >
@@ -56,51 +57,61 @@ <h1 id="{{ page.title | slugify }}">
56
57
57
58
</ article >
58
59
</ main >
59
- < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/algoliasearch-lite.umd.js "
integrity ="
sha256-EXPXz4W6pQgfYY3yTpnDa3OH8/EPn16ciVsPQ/ypsjk= "
crossorigin ="
anonymous "
> </ script >
60
- < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/instantsearch.production.min.js "
integrity ="
sha256-LAGhRRdtVoD6RLo2qDQsU2mp+XVSciKRC8XPOBWmofM= "
crossorigin ="
anonymous "
> </ script >
60
+ < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/algoliasearch-lite.umd.js "
61
+ integrity ="sha256-EXPXz4W6pQgfYY3yTpnDa3OH8/EPn16ciVsPQ/ypsjk= " crossorigin ="anonymous "> </ script >
62
+ < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/instantsearch.production.min.js "
63
+ integrity ="sha256-LAGhRRdtVoD6RLo2qDQsU2mp+XVSciKRC8XPOBWmofM= " crossorigin ="anonymous "> </ script >
61
64
62
65
< script >
63
- const appId = 'UINQ2M4D9S' ;
64
- const apiKey = '636b6d9e2dfb207e89ea7344859848f9' ;
65
- const searchClient = algoliasearch ( appId , apiKey ) ;
66
-
67
- const instantSearch = instantsearch ( {
68
- indexName : 'segment-docs' ,
69
- searchClient,
70
- routing : true ,
71
- facetFilters : [ 'hidden:-true' ] ,
72
-
73
- } ) ;
66
+ const appId = 'UINQ2M4D9S' ;
67
+ const apiKey = '636b6d9e2dfb207e89ea7344859848f9' ;
68
+ const searchClient = algoliasearch ( appId , apiKey ) ;
74
69
75
- instantSearch . addWidgets ( [
76
- instantsearch . widgets . searchBox ( {
77
- container : '#searchbox' ,
78
- } ) ,
79
70
80
- instantsearch . widgets . configure ( {
81
- hitsPerPage : 7 ,
71
+ const instantSearch = instantsearch ( {
72
+ indexName : 'segment-docs' ,
73
+ searchClient,
74
+ routing : true ,
82
75
facetFilters : [ 'hidden:-true' ] ,
83
- } ) ,
84
-
85
- instantsearch . widgets . hits ( {
86
- container : '#hits' ,
87
- templates : {
88
- item ( item ) {
89
- if ( item . anchor != null ) {
90
- var anchorLink = "#" + item . anchor ;
91
- } else {
92
- var anchorLink = "" ;
93
- }
94
- return `<a class="aa-link" href="/docs${ item . url } ${ anchorLink } ">
95
- <p class="aa-title" >${ item . title } </h3>
76
+
77
+ } ) ;
78
+
79
+ instantSearch . addWidgets ( [
80
+ instantsearch . widgets . searchBox ( {
81
+ container : '#searchbox' ,
82
+ } ) ,
83
+
84
+ instantsearch . widgets . configure ( {
85
+ hitsPerPage : 10 ,
86
+ facetFilters : [ 'hidden:-true' ] ,
87
+ } ) ,
88
+
89
+ instantsearch . widgets . pagination ( {
90
+ container : '#pagination'
91
+
92
+ } ) ,
93
+
94
+ instantsearch . widgets . hits ( {
95
+ container : '#hits' ,
96
+ templates : {
97
+ item ( item ) {
98
+ if ( item . anchor != null ) {
99
+ var anchorLink = "#" + item . anchor ;
100
+ } else {
101
+ var anchorLink = "" ;
102
+ }
103
+ return `<a class="aa-link" href="/docs${ item . url } ${ anchorLink } ">
104
+ <p class="aa-title" >${ instantsearch . highlight ( { attribute : 'title' , hit : item } ) } </h3>
96
105
<p class="aa-heading">${ item . headings . join ( ' >' ) } </p>
97
- <p class="aa-content">${ item . content } </p></a>
106
+ <p class="aa-content">${ instantsearch . highlight ( { attribute : ' content' , hit : item } ) } </p></a>
98
107
` ;
108
+ }
99
109
}
100
- }
101
- } )
102
- ] ) ;
110
+ } )
111
+ ] ) ;
112
+
113
+
103
114
104
- instantSearch . start ( ) ;
115
+ instantSearch . start ( ) ;
105
116
106
117
</ script >
0 commit comments