beautifulSA-jekyll/_includes/search.html
Marco Blessing 6a84cef6a2
Fetch upstream (#5)
* fix(#744): Escape special characters in title (#745)

* add matt artist as sponsor

* Fix margin top alignment issue on Safari (#750)

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Remove references to any public Staticman API instance (#775)

* Update CHANGELOG.md

* Adding option for Medium Social Link at footer  (#784)

* Itch.io social link (#788)

* Update CHANGELOG.md

* Add support for Cloudflare analytics (#798)

* Include Reddit in share options of posts (#815)

* add search to the navbar using 'post_search' config param

* Update CHANGELOG.md

* ui: make sure search results dont have underline until hovered

* search feature: make sure page scrollbar disappears when searching but a scrollbar for search items shows if needed

* update changelog

Co-authored-by: Dmitry <dmitry.b.danilov@gmail.com>
Co-authored-by: Dean Attali <dean@attalitech.com>
Co-authored-by: Amy Troschinetz <lexicalunit@lexicalunit.com>
Co-authored-by: Dean Attali <daattali@gmail.com>
Co-authored-by: Vincent Tam <VincentTam@users.noreply.github.com>
Co-authored-by: Diksha Verma <112dikshaverma@gmail.com>
Co-authored-by: Emaleth <Emaleth@protonmail.com>
Co-authored-by: Ari Kalfus <dev@artis3nal.com>
Co-authored-by: Leedan <l33d4n@gmail.com>
Co-authored-by: Marco Blessing <marco.blessing@komm.one>
2021-08-02 17:02:35 +02:00

40 lines
1.7 KiB
HTML

{% if site.post_search %}
<div id="beautifuljekyll-search-overlay">
<div id="nav-search-exit" title="Exit search"></div>
<input type="text" id="nav-search-input" placeholder="Search">
<ul id="search-results-container"></ul>
<script src="https://unpkg.com/simple-jekyll-search@latest/dest/simple-jekyll-search.min.js"></script>
<script>
var searchjson = '[ \
{% for post in site.posts %} \
{ \
"title" : "{% if post.title != "" %}{{ post.title | escape }}{% else %}{{ post.excerpt | strip_html | escape | strip }}{%endif%}", \
"category" : "{{ post.tags | join: \', \' }}", \
"url" : "{{ site.baseurl }}{{ post.url }}", \
"date" : "{{ post.date | date: "%B %e, %Y" | default: "January 1, 1970" }}" \
}, \
{% endfor %} \
{% for page in site.html_pages %}{% if page.title != "{title}" and page.title != "404 - Page not found" %} \
{ \
"title" : "{% if page.title != "" %}{{ page.title | escape }}{% else %}{{ page.excerpt | strip_html | escape | strip }}{% endif %}", \
"category" : "{% if page.tags %}{{ page.tags | join: \', \' }}{% else %}page{% endif %}", \
"url" : "{{ site.baseurl }}{{ page.url }}", \
"date" : "{{ page.date | date: '%B %e, %Y' | default: "January 1, 1970" }}" \
}{% unless forloop.last %},{% endunless %} \
{% endif %}{% endfor %} \
]';
searchjson = JSON.parse(searchjson);
var sjs = SimpleJekyllSearch({
searchInput: document.getElementById('nav-search-input'),
resultsContainer: document.getElementById('search-results-container'),
json: searchjson
});
</script>
</div>
{% endif %}