load stork index on click

This commit is contained in:
Elias Kirchgässner 2022-09-06 09:51:50 +02:00
parent 1b2844e926
commit 82de4cb504
2 changed files with 6 additions and 7 deletions

View file

@ -23,7 +23,7 @@
</form>
{% elif 'pelican.plugins.search' in PLUGINS %}
<div class="stork">
<input class="stork-input" type="text" autocomplete="off" name="q" data-stork="sitesearch" placeholder="{{ _('Search...') }}"/>
<input class="stork-input" type="text" autocomplete="off" name="q" data-stork="sitesearch" placeholder="{{ _('Search...') }}" onclick="loadStorkIndex()"/>
<div class="stork-output" data-stork="sitesearch-output"></div>
</div>
{% endif %}

View file

@ -1,13 +1,12 @@
{% if 'pelican.plugins.search' in PLUGINS %}
<script>
window.loadStorkIndex = function () {
stork.register("sitesearch", "{{ SITEURL }}/search-index.st", { showProgress: false });
}
</script>
{% if STORK_VERSION %}
<script src="https://files.stork-search.net/releases/v{{ STORK_VERSION }}/stork.js"></script>
<script>
stork.register("sitesearch", "{{ SITEURL }}/search-index.st", {showProgress: false});
</script>
{% else %}
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stork/stork.js"></script>
<script>
stork.register("sitesearch", "{{ SITEURL }}/search-index.st", {showProgress: false});
</script>
{% endif %}
{% endif %}