42 lines
1.8 KiB
HTML
42 lines
1.8 KiB
HTML
{{ $cdn_url := .Scratch.Get "cdn_url" }}
|
|
{{ $postHasImages := .Scratch.Get "postHasImages"}}
|
|
{{ if .IsPage }}
|
|
{{ $jquery := resources.Get "/js/jquery.min.js" }}
|
|
{{ $lazysizes := resources.Get "/js/lazysizes.min.js"}}
|
|
{{ $prettify := resources.Get "/js/prettify.min.js" }}
|
|
{{ $dynamic := resources.Get "/js/dynamic.to.top.min.js" }}
|
|
{{ $main := resources.Get "/js/main.js" }}
|
|
{{ $page := resources.Get "/js/page.js" }}
|
|
{{ $lihtGallery := resources.Get "/js/lightGallery-all.min.js" }}
|
|
{{ $lihtGallery_init := resources.Get "/js/lightGallery-init.js" }}
|
|
|
|
|
|
{{ if $postHasImages }}
|
|
<link href="//lib.baomitu.com/lightgallery/1.6.11/css/lightgallery.min.css" rel="stylesheet">
|
|
{{ $vendorscript := slice $jquery $lazysizes $prettify $dynamic $main $page $lihtGallery $lihtGallery_init | resources.Concat "/js/vendor0.js" | resources.Minify }}
|
|
<script src="{{ printf "%s%s" $cdn_url $vendorscript.RelPermalink }}" async="" ></script>
|
|
{{ else }}
|
|
{{ $vendorscript := slice $jquery $prettify $dynamic $main $page | resources.Concat "/js/vendor1.js" | resources.Minify }}
|
|
<script src="{{ printf "%s%s" $cdn_url $vendorscript.RelPermalink }}" async=""></script>
|
|
{{ end }}
|
|
|
|
|
|
{{ else }}
|
|
{{ $main := resources.Get "/js/main.js" | resources.Minify}}
|
|
<script src="{{ printf "%s%s" $cdn_url $main.RelPermalink }}" async=""></script>
|
|
{{ end }}
|
|
|
|
{{ if eq ( getenv "HUGO_ENV" ) "production" }}
|
|
{{ template "_internal/google_analytics_async.html" . }}
|
|
{{ with .Site.Params.baiduAnalytics}}
|
|
<script>
|
|
var _hmt = _hmt || [];
|
|
(function() {
|
|
var hm = document.createElement("script");
|
|
hm.src = "https://hm.baidu.com/hm.js?{{.}}";
|
|
var s = document.getElementsByTagName("script")[0];
|
|
s.parentNode.insertBefore(hm, s);
|
|
})();
|
|
</script>
|
|
{{ end }}
|
|
{{ end }} |