-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathsearch.html
More file actions
66 lines (60 loc) · 2.29 KB
/
search.html
File metadata and controls
66 lines (60 loc) · 2.29 KB
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
62
63
64
65
66
---
layout: page
title: 搜索
permalink: search.html
---
{% include get_baseurl.html %}
<input type="text" id="search-input" placeholder="搜索..." style="margin: 0px 0px 20px 0px; height: 40px; width: 100%;">
<div id="post-list">
<div id="results-container">
</div>
</div>
<style>
#post-list .title-box>.post-title {
margin-bottom: 0px;
padding-bottom: 0px;
padding-top: 0px;
}
</style>
<script src="{{ baseURL }}/static/lib/simple-jekyll-search.min.js"></script>
<script>
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
json: "{{ baseURL }}/data/search.json",
noResultsText: "<span style=\"font-size: 18.2px;\">未找到结果</span>",
limit: 13,
templateMiddleware: function (prop, value) {
if (prop === "tags") {
if (value) {
var tags = value.split(", ")
return tags.map(function (tag) {
return "<a class=\"tag\" href=\"{{ baseURL }}/tags.html#" + tag + "\">" + tag + "</a>"
}).join("\n")
} else {
return ""
}
}
},
searchResultTemplate:
"<div class=\"post-body-wrap post-body-wrap-list post-row\" style=\"padding: 10px 5px 10px 5px;\">\n" +
" <div class=\"title-box clearfix\">\n" +
" <div class=\"post-title title\">\n" +
" <a target=\"_blank\" href=\"{{ baseURL }}{url}\">\n" +
" {title}\n" +
" </a>\n" +
" </div>\n" +
" <div class=\"tags tag-pad\" style=\"margin:3px 0 3px 10px;\">\n" +
" {tags}\n" +
" </div>\n" +
" <div class=\"post-action\" style=\"padding:0;margin-top:10px;\">\n" +
" <span class=\"userlink muted btn-gray\">\n" +
" <span class=\"btn-gray\">\n" +
" {date}\n" +
" </span>\n" +
" </span>\n" +
" </div>\n" +
" </div>\n" +
"</div>"
})
</script>