-
Notifications
You must be signed in to change notification settings - Fork 12
/
search.html
62 lines (52 loc) · 2 KB
/
search.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
layout: search
title: Search
sitemap: false
---
<form action="/search.html" method="get">
<label for="search-box"><h2></h2></label>
<ul class="actions">
<li><input type="text" name="query" id="search-box" placeholder="Search" /></li>
<li><input type="submit" class = "button special icon fa-envelope" value = "Search" aria-label="Search in this site"></li></ul>
</form>
<h3 id="query-output"></h3>
<ol id="search-results"></ol>
<script type="text/javascript">
// Grab the output eleent
// "el" is the parameter that references the "this" argument that was passed
$(document).ready(function() {
var output = document.getElementById('query-output');
var myurl = new URL(window.location.href);
var qparam = myurl.searchParams.get("query");
output.innerHTML = qparam;
});
</script>
<script>
window.store = {
{% for post in site.posts %}
"{{ post.url | slugify }}": {
"title": "{{ post.title | xml_escape }}",
"author": "{{ post.author | xml_escape }}",
"category": "{{ post.category | xml_escape }}",
"description": "{{ post.description | xml_escape }}",
"tags" : "{{ post.tags | join: ', ' }}",
"content": {{ post.content | strip_html | strip_newlines | jsonify }},
"url": "{{ post.url | xml_escape }}"
},
{% endfor %}
{% for post in site.projects %}
"{{ post.url | slugify }}": {
"title": "{{ post.title | xml_escape }}",
"author": "{{ post.author | xml_escape }}",
"category": "{{ post.category | xml_escape }}",
"description": "{{ post.description | xml_escape }}",
"tags" : "{{ post.tags | join: ', ' }}",
"content": {{ post.content | strip_html | strip_newlines | jsonify }},
"url": "{{ post.url | xml_escape }}"
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
};
</script>
<script src="assets/js/lunr.min.js"></script>
<script src="assets/js/search.js"></script>