Merge pull request #312 from lioman/improve-stork-loading

Improve stork loading
This commit is contained in:
Alexandre Vicenzi 2022-12-01 12:00:56 +01:00 committed by GitHub
commit fe34dfed6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 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,15 @@
{% if 'pelican.plugins.search' in PLUGINS %}
<script>
window.loadStorkIndex = function () {
{% if not STORK_VERSION %}
stork.initialize("{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stork/stork.wasm")
{% endif %}
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 %}