summaryrefslogtreecommitdiff
path: root/assets/js
diff options
context:
space:
mode:
authorYehonal <yehonal.azeroth@gmail.com>2020-01-07 08:19:13 +0100
committerYehonal <yehonal.azeroth@gmail.com>2020-01-07 08:19:13 +0100
commit7341eb7c340d8291b86268281db274e52cc3cf1b (patch)
tree2e13b2b275ee4737fe3a43695314925896b8d926 /assets/js
parentfcaad425c74946f022409c7da2c88c9592fd9c28 (diff)
downloadwiki-7341eb7c340d8291b86268281db274e52cc3cf1b.tar.gz
wiki-7341eb7c340d8291b86268281db274e52cc3cf1b.tar.bz2
wiki-7341eb7c340d8291b86268281db274e52cc3cf1b.zip
move searchdata under assets/js
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/searchdata.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/assets/js/searchdata.js b/assets/js/searchdata.js
new file mode 100644
index 0000000..7c46fed
--- /dev/null
+++ b/assets/js/searchdata.js
@@ -0,0 +1,44 @@
+---
+layout: null
+is_wiki_page: false
+---
+{% if site.search_engine == "js" %}
+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 | remove: '"' }}"
+ } {% unless forloop.last %},{% endunless %}
+ {% endfor %}
+ ,
+ {% for page in site.html_pages %}
+ {
+ {% assign title = page.title | default: page.name %}
+ {% if title != nil %}
+ "title" : "{{ title | escape }}",
+ "category" : "{{ page.category }}",
+ "tags" : "{{ page.tags | join: ', ' }}",
+ "url" : "{{ site.baseurl }}{{ page.url }}",
+ "date" : "{{ page.date }}",
+ "content" : "{{ page.content | strip_html | strip_newlines | remove: '"' }}"
+ {% 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: []
+ })
+{% endif %}
+