{{/* Mermaid */}} {{ if .Page.HasShortcode "mermaid" }} {{ $mermaidLib := resources.Get "lib/mermaid/mermaid.min.js" }} {{ $mermaidConfig := resources.Get "js/mermaid.js" }} {{ $mermaidConfig := $mermaidConfig | resources.Minify }} {{ $mermaidJS := slice $mermaidLib $mermaidConfig | resources.Concat "js/mermaid.bundle.js" | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} {{/* Chart */}} {{ if .Page.HasShortcode "chart" }} {{ $chartLib := resources.Get "lib/chart/chart.min.js" }} {{ $chartConfig := resources.Get "js/chart.js" }} {{ $chartConfig := $chartConfig | resources.Minify }} {{ $chartJS := slice $chartLib $chartConfig | resources.Concat "js/chart.bundle.js" | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} {{/* Katex */}} {{ if .Page.HasShortcode "katex" }} {{ $katexCSS := resources.Get "lib/katex/katex.min.css" }} {{ $katexCSS := $katexCSS | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ $katexLib := resources.Get "lib/katex/katex.min.js" }} {{ $katexRenderLib := resources.Get "lib/katex/auto-render.min.js" }} {{ $katexJS := slice $katexLib $katexRenderLib | resources.Concat "js/katex.bundle.js" | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ $katexFonts := resources.Match "lib/katex/fonts/*" }} {{ range $katexFonts }} {{ end }} {{ end }} {{/* TypeIt */}} {{ if .Page.HasShortcode "typeit" }} {{ $typeitLib := resources.Get "lib/typeit/typeit.umd.js" | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} {{/* Packery */}} {{ if .Page.HasShortcode "gallery" }} {{ $galleryCSS := resources.Get "css/components/gallery.css" }} {{ $galleryCSS = $galleryCSS | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ $packeryLib := resources.Get "lib/packery/packery.pkgd.min.js" }} {{ $packeryLib = $packeryLib | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ $jsShortcodeGallery := resources.Get "js/shortcodes/gallery.js" }} {{ $jsShortcodeGallery = $jsShortcodeGallery | resources.Minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} {{/* tw-elements */}} {{ if or (.Page.HasShortcode "carousel") (.Page.HasShortcode "timeline") }} {{ $carouselCSS := resources.Get "css/components/carousel.css" }} {{ $carouselCSS = $carouselCSS | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ $twelementsLib := resources.Get "lib/tw-elements/index.min.js" }} {{ $twelementsLib = $twelementsLib | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} {{/* youtubeLite */}} {{ if .Page.HasShortcode "youtubeLite" }} {{ $youtubeLiteCSS := resources.Get "lib/lite-youtube-embed/lite-yt-embed.css" }} {{ $youtubeLiteCSS = $youtubeLiteCSS | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ $youtubeLiteLib := resources.Get "lib/lite-youtube-embed/lite-yt-embed.js" }} {{ $youtubeLiteLib = $youtubeLiteLib | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} {{/* Repo cards */}} {{ $repoCards := slice "codeberg" "forgejo" "gitea" "github" "hugging-face" }} {{ $hasRepoCards := false }} {{ range $repoCards }} {{ if $.Page.HasShortcode . }} {{ $hasRepoCards = true }} {{ end }} {{ end }} {{ if $hasRepoCards }} {{ $repoColors := site.Data.repoColors }} {{ $cssRules := slice }} {{/* default color */}} {{ $cssRules = $cssRules | append ".language-dot[data-language=\"default\"] { background-color: #0077b6; }" }} {{/* Hugging Face model color */}} {{ $cssRules = $cssRules | append ".language-dot[data-language=\"model\"] { background-color: #ff6b35; }" }} {{ range $lang, $color := $repoColors }} {{ $cssRules = $cssRules | append (printf ".language-dot[data-language=\"%s\"] { background-color: %s; }" $lang $color) }} {{ end }} {{ $repoCardCSS := resources.FromString "css/repo-cards.css" (delimit $cssRules "\n") | minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} {{/* tabs */}} {{ if .Page.HasShortcode "tabs" }} {{ $tabJS := resources.Get "js/shortcodes/tabs.js" }} {{ with $tabJS | minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} {{ end }} {{/* Firebase */}} {{ if site.Params.firebase.apiKey }} {{ $firebase := resources.Get "js/firebase.js" }} {{ $firebase = $firebase | resources.Minify | resources.Fingerprint (site.Params.fingerprintAlgorithm | default "sha512") }} {{ if in (slice "page" "section") .Kind }} {{ $translations := .AllTranslations }} {{ with .File }} {{ $path := .Path }} {{ range $translations }} {{ $path = replace $path (print "." .Lang ".md") ".md" }} {{ end }} {{ partial "inline/firebase-config.html" (dict "views" (printf "views_%s" $path) "likes" (printf "likes_%s" $path)) }} {{ end }} {{ else if eq .Kind "term" }} {{ partial "inline/firebase-config.html" (dict "views" (printf "views_term_%s" .Data.Term) "likes" (printf "likes_term_%s" .Data.Term)) }} {{ else if eq .Kind "taxonomy" }} {{ partial "inline/firebase-config.html" (dict "views" (printf "views_taxonomy_%s" .Data.Plural) "likes" (printf "likes_taxonomy_%s" .Data.Plural)) }} {{ else if eq .Kind "home" }} {{ partial "inline/firebase-config.html" (dict "views" "views_home" "likes" "likes_home") }} {{ end }} {{ end }} {{ define "_partials/inline/firebase-config.html" }} {{ end }}