diff options
Diffstat (limited to 'templates/macros/head.html')
| -rw-r--r-- | templates/macros/head.html | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/templates/macros/head.html b/templates/macros/head.html index 0fbae7c..c3b217c 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -1,3 +1,4 @@ +{#- Theme Switcher Button to toggle between dark/light #} {%- macro theme() %} {%- if config.extra.js_theme %} {%- if config.extra.js_themeButton or config.extra.js_bundle %} @@ -70,19 +71,35 @@ {%- endif %} {%- endif %} -{%- if config.build_search_index and config.extra.js_bundle %} +{%- if config.extra.js_bundle and config.build_search_index or config.extra.js_bundle and config.extra.search_library %} {%- if config.extra.js_search_facade %} - {# dont load the index #} + {#- dont load the index #} + {%- elif config.extra.search_library == "tinysearch" or config.extra.search_library == "stork" %} + {#- dont load the index #} {%- elif config.extra.js_search_index %} <script defer src="{{ get_url(path=config.extra.js_search_index, trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path=config.extra.js_search_index, sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} - {%- if config.extra.js_bundle %} - <script defer src="{{ get_url(path=config.extra.js_bundle, trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path=config.extra.js_bundle, sha_type=384, base64=true) | safe }}"{%- endif %}></script> + + {%- if not config.extra.js_search_facade %} + + {%- if config.extra.js_switcher %} + <script defer src="{{ get_url(path='abridge-bundle-nofacade.min.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='abridge-bundle-nofacade.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- else %} + <script defer src="{{ get_url(path='abridge-bundle-noswitcher.min.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='abridge-bundle-nofacade.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- endif %} + + {%- elif config.extra.search_library == "tinysearch" %} + <script defer src="{{ get_url(path='abridge-bundle-tinysearch.min.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='abridge-bundle-tinysearch.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- elif config.extra.search_library == "stork" %} + <script defer src="{{ get_url(path='abridge-bundle-stork.min.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='abridge-bundle-stork.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- else %} + <script defer src="{{ get_url(path='abridge-bundle.min.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='abridge-bundle.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} -{%- elif config.build_search_index %} + +{%- elif config.build_search_index or config.extra.search_library %} {#- no bundle #} @@ -90,8 +107,8 @@ {%- if config.extra.js_prestyle %} <script defer src="{{ get_url(path=config.extra.js_prestyle, trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path=config.extra.js_prestyle, sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} - {%- endif %} + {%- if config.extra.js_theme %} {%- if config.extra.js_themeButton %} <script defer src="{{ get_url(path=config.extra.js_themeButton, trailing_slash=false) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path=config.extra.js_themeButton, sha_type=384, base64=true) | safe }}"{%- endif %}></script> @@ -109,26 +126,39 @@ {%- endif %} {%- if config.extra.js_search_facade %} + {%- if config.extra.search_library %} + {%- if config.extra.search_library == "tinysearch" %} + <script defer src="{{ get_url(path='search_facade_tinysearch.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='search_facade_tinysearch.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- elif config.extra.search_library == "stork" %} + <script defer src="{{ get_url(path='search_facade_stork.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='search_facade_stork.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- endif %} + {%- endif %} <script defer src="{{ get_url(path='search_facade.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='search_facade.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} - {%- if config.extra.js_search_facade %} - <script defer src="{{ get_url(path=config.extra.js_search_facade, trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path=config.extra.js_search_facade, sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- if config.extra.js_search_facade or config.extra.search_library %} + {#- dont load the index/search #} {%- elif config.extra.js_search_index %} <script defer src="{{ get_url(path=config.extra.js_search_index, trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path=config.extra.js_search_index, sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} + {%- if config.extra.js_search_facade %} - {# dont load the index/search #} - {%- elif config.extra.js_search %}{%- for i in config.extra.js_search %} - <script defer src="{{ get_url(path=i, trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path=i, sha_type=384, base64=true) | safe }}"{%- endif %}></script> - {%- endfor %}{%- endif %} + {#- dont load the index/search #} + {%- else %} + {%- if config.extra.search_library == "tinysearch" %} + <script defer type="module" src="{{ get_url(path='tinysearch.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='tinysearch.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- elif config.extra.search_library == "stork" %} + <script defer type="module" src="{{ get_url(path='stork.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='stork.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- else %} + <script defer src="{{ get_url(path='elasticlunr.min.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='elasticlunr.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='search.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='search.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- endif %} + {%- endif %} {%- elif config.extra.js_bundle %} {#- no search #} - <script defer src="{{ get_url(path=config.extra.js_bundle, trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path=config.extra.js_bundle, sha_type=384, base64=true) | safe }}"{%- endif %}></script> - {%- else %} {#- no bundle or search #} |
