mirror of
https://gitlab.com/ansol/web-ansol.org.git
synced 2024-12-29 07:06:05 +00:00
79 lines
3.4 KiB
HTML
79 lines
3.4 KiB
HTML
{{ $scr := $.Scratch -}}
|
|
|
|
{{/* Attempt to load local vendor JS, otherwise load from CDN. */}}
|
|
{{ $js := site.Data.assets.js }}
|
|
|
|
{{/* Maps JS. */}}
|
|
{{ if and (or (eq site.Params.map.engine 2) (eq site.Params.map.engine 3)) ($scr.Get "use_cdn") }}
|
|
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.leaflet.url $js.leaflet.version) $js.leaflet.sri | safeHTML }}
|
|
{{ end }}
|
|
|
|
{{/* Initialise code highlighting. */}}
|
|
{{ if $scr.Get "highlight_enabled" }}
|
|
<script>const code_highlighting = true;</script>
|
|
{{ else }}
|
|
<script>const code_highlighting = false;</script>
|
|
{{ end }}
|
|
|
|
{{/* Initialise default theme. */}}
|
|
{{ if eq ($scr.Get "light") true }}
|
|
<script>const isSiteThemeDark = false;</script>
|
|
{{ else }}
|
|
<script>const isSiteThemeDark = true;</script>
|
|
{{ end }}
|
|
|
|
{{ if ne site.Params.search.engine 0 }}
|
|
{{/* Configure search engine. */}}
|
|
{{ $min_length := site.Params.search.academic.min_length | default 1 }}
|
|
{{ $threshold := site.Params.search.academic.threshold | default 0.3 }}
|
|
{{ $search_i18n := dict "placeholder" (i18n "search_placeholder") "results" (i18n "search_results") "no_results" (i18n "search_no_results") }}
|
|
{{ $search_config := dict "indexURI" ("/index.json" | relLangURL) "threshold" $threshold "minLength" $min_length }}
|
|
<script>
|
|
const search_config = {{ $search_config | jsonify | safeJS }};
|
|
const i18n = {{ $search_i18n | jsonify | safeJS }};
|
|
const content_type = {
|
|
'noticias': {{ i18n "noticias" }},
|
|
'eventos': {{ i18n "eventos" }},
|
|
'iniciativas' : {{ i18n "iniciativas" }},
|
|
'slides' : {{ i18n "slides" | default (i18n "btn_slides") }}
|
|
};
|
|
</script>
|
|
{{ end }}
|
|
|
|
{{/* Load hash anchors for documentation pages. */}}
|
|
{{ if eq .Type "docs" }}
|
|
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.anchor.url $js.anchor.version) $js.anchor.sri | safeHTML }}
|
|
<script>
|
|
anchors.add();
|
|
</script>
|
|
{{ end }}
|
|
|
|
{{ if eq site.Params.search.engine 1 }}
|
|
{{/* Fuse search result template. */}}
|
|
<script id="search-hit-fuse-template" type="text/x-template">
|
|
<div class="search-hit" id="summary-{{"{{key}}"}}">
|
|
<div class="search-hit-content">
|
|
<div class="search-hit-name">
|
|
{{ printf "<a href=\"%s\">%s</a>" "{{relpermalink}}" "{{title}}" | safeHTML }}
|
|
<div class="article-metadata search-hit-type">{{"{{type}}"}}</div>
|
|
<p class="search-hit-description">{{"{{snippet}}"}}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</script>
|
|
{{ end }}
|
|
|
|
{{/* Fuse search engine. */}}
|
|
{{ if and (eq site.Params.search.engine 1) ($scr.Get "use_cdn") }}
|
|
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.fuse.url $js.fuse.version) $js.fuse.sri | safeHTML }}
|
|
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.mark.url $js.mark.version) $js.mark.sri | safeHTML }}
|
|
{{ end }}
|
|
|
|
{{ $js_academic_search := resources.Get "js/academic-search.js" }}
|
|
{{ $js_fuse := resources.Get "js/vendor/fuse.min.js" }}
|
|
{{ $js_mark := resources.Get "js/vendor/mark.min.js" }}
|
|
{{ $js_bundle := slice $js_mark $js_fuse $js_academic_search | resources.Concat "js/academic.min.js" }}
|
|
<script src="{{ $js_bundle.RelPermalink }}"></script>
|
|
|
|
{{ partial "custom_js" . }}
|