From a20700595d3c9aeba0d8265e25e720e67c9641c5 Mon Sep 17 00:00:00 2001 From: Dillon Date: Fri, 7 Feb 2020 21:42:47 +0800 Subject: [PATCH] fix(scripts): fix CDN not work bug --- layouts/partials/scripts.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 01272340..26cee90a 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 -}}