diff options
| author | Yehonal <yehonal.azeroth@gmail.com> | 2018-12-23 11:18:54 +0100 |
|---|---|---|
| committer | Yehonal <yehonal.azeroth@gmail.com> | 2018-12-23 15:19:22 +0100 |
| commit | f73bd860bb566be9684876c68f6c55fd1940fddf (patch) | |
| tree | 2be0b4f08eaf3fc5de23a2826b6abce6feb0b5bf /searchdata.js | |
| parent | 55814019cacf484b8d6882c91b90bd7758e295c9 (diff) | |
| download | wiki-f73bd860bb566be9684876c68f6c55fd1940fddf.tar.gz wiki-f73bd860bb566be9684876c68f6c55fd1940fddf.tar.bz2 wiki-f73bd860bb566be9684876c68f6c55fd1940fddf.zip | |
Implemented new js search method (faster)
# Conflicts:
# _includes/git-wiki/components/search/se_js.html
Diffstat (limited to 'searchdata.js')
| -rw-r--r-- | searchdata.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/searchdata.js b/searchdata.js new file mode 100644 index 0000000..bb6eb25 --- /dev/null +++ b/searchdata.js @@ -0,0 +1,41 @@ +--- +layout: null +--- + +var jsondata=[ + {% for post in site.posts %} + { + "title" : "{{ post.title | escape }}", + "category" : "{{ post.category }}", + "tags" : "{{ post.tags | join: ', ' }}", + "url" : "{{ site.baseurl }}{{ post.url }}", + "date" : "{{ post.date }}", + "content" : "{{ post.content | strip_html | strip_newlines }}" + } {% unless forloop.last %},{% endunless %} + {% endfor %} + , + {% for page in site.pages %} + { + {% if page.title != nil %} + "title" : "{{ page.title | escape }}", + "category" : "{{ page.category }}", + "tags" : "{{ page.tags | join: ', ' }}", + "url" : "{{ site.baseurl }}{{ page.url }}", + "date" : "{{ page.date }}", + "content" : "{{ page.content | strip_html | strip_newlines }}" + {% endif %} + } {% unless forloop.last %},{% endunless %} + {% endfor %} +]; + +var sjs = SimpleJekyllSearch({ + searchInput: document.getElementById('search-input'), + resultsContainer: document.getElementById('results-container'), + json: jsondata, + searchResultTemplate: '<li><a href="{url}" title="{desc}">{title}</a></li>', + noResultsText: 'No results found', + limit: 10, + fuzzy: false, + exclude: [] + }) + |
