From 7341eb7c340d8291b86268281db274e52cc3cf1b Mon Sep 17 00:00:00 2001 From: Yehonal Date: Tue, 7 Jan 2020 08:19:13 +0100 Subject: move searchdata under assets/js --- _includes/git-wiki/components/search/se_js.html | 2 +- assets/js/searchdata.js | 44 +++++++++++++++++++++++++ searchdata.js | 44 ------------------------- 3 files changed, 45 insertions(+), 45 deletions(-) create mode 100644 assets/js/searchdata.js delete mode 100644 searchdata.js diff --git a/_includes/git-wiki/components/search/se_js.html b/_includes/git-wiki/components/search/se_js.html index 85e168c..87396be 100644 --- a/_includes/git-wiki/components/search/se_js.html +++ b/_includes/git-wiki/components/search/se_js.html @@ -4,4 +4,4 @@ - + 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: '
  • {title}
  • ', + noResultsText: 'No results found', + limit: 10, + fuzzy: false, + exclude: [] + }) +{% endif %} + diff --git a/searchdata.js b/searchdata.js deleted file mode 100644 index 7c46fed..0000000 --- a/searchdata.js +++ /dev/null @@ -1,44 +0,0 @@ ---- -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: '
  • {title}
  • ', - noResultsText: 'No results found', - limit: 10, - fuzzy: false, - exclude: [] - }) -{% endif %} - -- cgit