diff --git a/layouts/partials/plugin/script.html b/layouts/partials/plugin/script.html
index cb4ea122..9b5b23b4 100644
--- a/layouts/partials/plugin/script.html
+++ b/layouts/partials/plugin/script.html
@@ -7,19 +7,21 @@
{{- else -}}
{{- $src := .Source -}}
{{- $integrity := .Integrity -}}
- {{- if (urls.Parse $src).Host | not -}}
- {{- $resource := resources.Get $src -}}
- {{- with .Template -}}
- {{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
+ {{- if $src -}}
+ {{- if (urls.Parse $src).Host | not -}}
+ {{- $resource := resources.Get $src -}}
+ {{- with .Template -}}
+ {{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
+ {{- end -}}
+ {{- if .Minify -}}
+ {{- $resource = $resource | minify -}}
+ {{- end -}}
+ {{- with .Fingerprint -}}
+ {{- $resource = $resource | fingerprint . -}}
+ {{- $integrity = $resource.Data.Integrity -}}
+ {{- end -}}
+ {{- $src = $resource.RelPermalink -}}
{{- end -}}
- {{- if .Minify -}}
- {{- $resource = $resource | minify -}}
- {{- end -}}
- {{- with .Fingerprint -}}
- {{- $resource = $resource | fingerprint . -}}
- {{- $integrity = $resource.Data.Integrity -}}
- {{- end -}}
- {{- $src = $resource.RelPermalink -}}
+
{{- end -}}
-
{{- end -}}