diff options
| author | Jieiku | 2024-08-05 18:07:12 -0700 |
|---|---|---|
| committer | Jieiku | 2024-08-05 18:07:12 -0700 |
| commit | 6c195035966d1b1d2cac50f9aacc3617b3a0e475 (patch) | |
| tree | 1e6b12dafd9d214ae86d09db96cab3119503e366 /templates/partials | |
| parent | 8e7498017f7d423cf45dc58dc9d254904ccd08d0 (diff) | |
| download | abridge-6c195035966d1b1d2cac50f9aacc3617b3a0e475.tar.gz abridge-6c195035966d1b1d2cac50f9aacc3617b3a0e475.tar.bz2 abridge-6c195035966d1b1d2cac50f9aacc3617b3a0e475.zip | |
simplify switching search library
Diffstat (limited to 'templates/partials')
| -rw-r--r-- | templates/partials/head.html | 4 | ||||
| -rw-r--r-- | templates/partials/head_js.html | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/templates/partials/head.html b/templates/partials/head.html index 98d2382..1b95cc8 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -1,7 +1,7 @@ {#- Theme Switcher Button to toggle between dark/light #} {%- set integrity = config.extra.integrity | default(value=true) -%} - {%- if config.extra.offline %}{% set integrity = false %}{% endif %} + {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set integrity = false %}{% endif %}{% endif %} {%- if config.extra.js_switcher | default(value=true) %} {%- set js_theme="js/theme.min.js" %} @@ -90,7 +90,7 @@ {#- Style Sheets Preload #} {%- set integrity = config.extra.integrity | default(value=true) -%} - {%- if config.extra.offline %}{% set integrity = false %}{% endif %} + {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set integrity = false %}{% endif %}{% endif %} {%- if config.extra.fonts %}{%- for i in config.extra.fonts %} {%- if i.url is matching("^http[s]?://") %} diff --git a/templates/partials/head_js.html b/templates/partials/head_js.html index 33088ec..2a16b6d 100644 --- a/templates/partials/head_js.html +++ b/templates/partials/head_js.html @@ -1,6 +1,6 @@ {#- JAVASCRIPT #} {%- set integrity = config.extra.integrity | default(value=true) -%} - {%- if config.extra.offline %}{% set integrity = false %}{% endif %} + {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set integrity = false %}{% endif %}{% endif %} {%- set search_library=config.extra.search_library | default(value="elasticlunr") -%} {%- set preStyle = false %} @@ -75,8 +75,6 @@ {%- if search_library == "tinysearch" %} <script defer type="module" src="{{ get_url(path='js/tinysearch.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/tinysearch.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> - {%- elif search_library == "stork" %} - <script defer type="module" src="{{ get_url(path='js/search_stork.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/search_stork.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- elif config.build_search_index %} {%- set search_index_format="elasticlunr_json" -%} @@ -87,7 +85,7 @@ {%- endif %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} - {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} + {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} {%- if search_index_format == "elasticlunr_javascript" %}{#- Javascript index format #} <script defer src="{{ get_url(path='js/elasticlunr.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/elasticlunr.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> <script defer src="{{ get_url(path='search_index.' ~ lang ~ '.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='search_index.' ~ lang ~ '.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> @@ -163,4 +161,4 @@ -{#- End of head_js partial -#}
\ No newline at end of file +{#- End of head_js partial -#} |
