forked from sgidevnet/sgidevnet.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchdata.js
44 lines (42 loc) · 1.38 KB
/
searchdata.js
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
---
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 %}