Merge pull request #2333 from solgenomics/topic/location-fixes
[sgn.git] / docs / _includes / search.html
blob125a6cfc123bd9372132da45a7c42df2c6f63dce
1 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
2 <script src="{{'assets/tipuesearch/tipuesearch_set.js' | relative_url }}"></script>
3 <script type="text/javascript">
4 {% capture search_data %}
5 {% for entry in site.pages %}
6 {% unless entry.tags contains 'no_search' %}
7 {% assign size = entry.url.size | plus: 0 %}
8 {% assign neg_one = size | minus: 1 %}
9 {% assign neg_five = size | minus: 5 %}
10 {% assign last_char = entry.url | slice: neg_one , size %}
11 {% assign last_five = entry.url | slice: neg_five , size %}
12 {% if last_char == "/" or last_five == ".html" %}
13 {% assign search_text = entry.content | split: '<!-- SEARCH-CONTENT-START -->' | last | split: '<!-- SEARCH-CONTENT-END -->' | first %}
14 {% if search_text contains '<!-- TOC-START -->' %}
15 {% assign s1 = search_text | split: '<!-- TOC-START -->' | first %}
16 {% assign s2 = search_text | split: '<!-- TOC-END -->' | last %}
17 {% assign search_text = s1 | append: s2 %}
18 {% endif %}
19 {"title": "{{entry.title}}",
20 "text": {{search_text | strip_html | jsonify}},
21 "tags": "{{entry.tags | join: ' '}}",
22 "url": "{{ site.baseurl }}{{ entry.url }}"},
23 {% endif %}
24 {% endunless %}
25 {% endfor %}
26 {% endcapture %}
27 var tipuesearch = {"pages": [{{search_data}}]};
28 </script>
29 <script src="{{'assets/tipuesearch/tipuesearch.min.js' | relative_url }}"></script>
30 <script>
31 $(document).ready(function() {
32 $('#tipue_search_input').tipuesearch({
33 'mode': 'static'
34 });
35 });
36 </script>