bmen-jekyll/_includes/blog/search.html

25 lines
1.1 KiB
HTML

<!-- Simple-Jekyll-Search https://github.com/christian-fei/Simple-Jekyll-Search -->
<div class="input-group mt-5 px-3">
<input id="search-input" type="text" class="form-control search-box" placeholder="Search posts..">
<div class="input-group-append">
<span class="input-group-text border border-primary bg-primary text-white">
<i class="fas fa-search"></i>
</span>
</div>
<button class="btn btn-outline-primary ml-1" onclick="location.href = '{{ '/blog/tags' | relative_url }}';">
<i class="fas fa-tags"></i>
</button>
</div>
<ul class="px-3" id="results-container"></ul>
<script src="https://cdn.rawgit.com/christian-fei/Simple-Jekyll-Search/master/dest/simple-jekyll-search.min.js"></script>
<script>
var sjs = SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
searchResultTemplate: '<a href="{url}" class="list-group-item list-group-item-action">{title}</a>',
noResultsText: '<li class="list-group-item">No results found</li>',
json: '{{ '/search.json' | relative_url }}'
})
</script>