1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

A super huge improvement in search.

- Added a cleanup button within input form.
- Optimized TopBar responsive effect(for search layout).
- Redesign the search results layout.
This commit is contained in:
Cotes Chung
2019-12-31 23:17:27 +08:00
parent 83526cd67e
commit 3248343c22
21 changed files with 452 additions and 247 deletions

View File

@@ -0,0 +1,27 @@
<!--
Jekyll Simple Search loader
© 2017-2019 Cotes Chung
MIT License
-->
<script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.7.3/dest/simple-jekyll-search.min.js" integrity="sha256-qcLR00zq6pJk4je3MLgAri8Nn+ZumUlXgTKR2H/xCY0=" crossorigin="anonymous"></script>
{% capture result_elem %}
<div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0">
<a href="{{ site.url }}{url}">{title}</a>
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>{categories}</div>
<div><i class="fa fa-tag fa-fw"></i>{tags}</div>
</div>
<p>{snippet}</p>
</div>
{% endcapture %}
<script>
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('search-results'),
json: '{{ site.baseurl }}/search.json',
searchResultTemplate: '{{ result_elem }}',
noResultsText: '<p class="mt-5">Oops! No result founds.</p>'
});
</script>