diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 0127234..26cee90 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -35,17 +35,17 @@ {{- $smooth_scroll | safeHTML -}} {{- /* TypeIt https://github.com/alexmacarthur/typeit */ -}} -{{- with .Scratch.Get "typeitMap" -}} +{{- if .Scratch.Get "typeitMap" -}} {{- $typeit := "" -}} - {{- if eq (getenv "HUGO_ENV") "production" | and $.Site.Params.cdn.typeit_js -}} - {{- $typeit = $.Site.Params.cdn.typeit_js -}} + {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.typeit_js -}} + {{- $typeit = .Site.Params.cdn.typeit_js -}} {{- else -}} {{- $res := resources.Get "js/lib/typeit/typeit.min.js" -}} {{- $typeit = printf "" $res.RelPermalink -}} {{- end -}} {{- $typeit | safeHTML -}} {{- $typeitArr := slice -}} - {{- range $key, $val := . -}} + {{- range $key, $val := .Scratch.Get "typeitMap" -}} {{- $typeitArr = $typeitArr | append (slice $val) -}} {{- end -}} {{- end -}} @@ -174,7 +174,7 @@ {{- end -}} {{- /* jQuery.countdown https://github.com/hilios/jQuery.countdown */ -}} -{{- with .Scratch.Get "countdownMap" -}} +{{- if .Scratch.Get "countdownMap" -}} {{- $countdown := "" -}} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_countdown_js -}} {{- $countdown = .Site.Params.cdn.jquery_countdown_js -}} @@ -184,14 +184,14 @@ {{- end -}} {{- $countdown | safeHTML -}} {{- end -}} {{- /* dev feature */ -}} {{- if .Params.dev -}} {{- /* ECharts https://github.com/apache/incubator-echarts */ -}} - {{- with .Scratch.Get "echartsMap" -}} + {{- if .Scratch.Get "echartsMap" -}} {{- $echarts_js := "" -}} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_js -}} {{- $echarts_js = .Site.Params.cdn.echarts_js -}} @@ -210,7 +210,7 @@ {{- $echarts | safeHTML -}}