-
Notifications
You must be signed in to change notification settings - Fork 142
/
search.html
67 lines (63 loc) · 2.66 KB
/
search.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
---
title: Search
sitemap: false
permalink: /search/
not_editable: true
excluded_in_search: true
---
<input class="form-control td-search-input" type="search" name="q" id="search-input" placeholder=" Search this site…" style="margin-top:5px" autofocus>
<i style="color:white; margin-right:8px; margin-left:5px" class="fa fa-search"></i>
<p><span id="search-process">Loading</span> results <span id="search-query-container" style="display: none;">for "<strong id="search-query"></strong>"</span></p>
<ul id="search-results"></ul>
{% capture version_prefix %}/docs/{{ site.version_params.version_dir }}/{% endcapture %}
<script>
window.data = {
{% for post in site.docs %}
{% unless post.excluded_in_search %}
{% if added %},{% endif %}
{% assign added = false %}{% assign version_dir = post.url | split: version_prefix %}{% assign docs_version = version_dir[1] | split: "/" %}
"{{ post.url | slugify }}": {
"id": "{{ post.url | slugify }}",
"title": "{{ post.title | xml_escape }}",
"version": "{% if post.url contains site.version_params.version_dir %}{{ docs_version[0] }}{% else %}all{% endif %}",
"categories": "{{ post.categories | join: ", " | xml_escape }}",
"url": " {{ post.url | xml_escape }}",
"content": {{ post.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }}
}
{% assign added = true %}
{% endunless %}
{% endfor %}
{% for post in site.posts %}
{% unless post.excluded_in_search %}
{% if added %},{% endif %}
{% assign added = false %}
"{{ post.url | slugify }}": {
"id": "{{ post.url | slugify }}",
"title": "{{ post.title | xml_escape }}",
"version": "all",
"categories": "{{ post.categories | join: ", " | xml_escape }}",
"url": " {{ post.url | xml_escape }}",
"content": {{ post.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }}
}
{% assign added = true %}
{% endunless %}
{% endfor %}
{% for post in site.pages %}
{% unless post.excluded_in_search %}
{% if added %},{% endif %}
{% assign added = false %}
"{{ post.url | slugify }}": {
"id": "{{ post.url | slugify }}",
"title": "{{ post.title | xml_escape }}",
"version": "all",
"categories": "{{ post.categories | join: ", " | xml_escape }}",
"url": " {{ post.url | xml_escape }}",
"content": {{ post.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }}
}
{% assign added = true %}
{% endunless %}
{% endfor %}
};
</script>
<script src="{{ site.baseurl }}/assets/js/lunr.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/search.js"></script>