From f001df46426d05e66e3bf1c703107feea34d567d Mon Sep 17 00:00:00 2001
From: Cell <1024@lruihao.cn>
Date: Thu, 13 Jan 2022 14:39:30 +0800
Subject: [PATCH] :bug: Chore: fix plugin script error while content is empty
---
layouts/partials/plugin/script.html | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
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 -}}