From 2d94f80b79ece44643294d4e5bfaeb4f8f010d6f Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Mon, 24 Aug 2020 21:20:59 +0200 Subject: [PATCH] fix(sidebar): check if param exists before accessing avatar and icon --- layouts/partials/sidebar/left.html | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html index ff536a8..dacc85b 100644 --- a/layouts/partials/sidebar/left.html +++ b/layouts/partials/sidebar/left.html @@ -6,13 +6,15 @@
-
- {{ $avatar := resources.Get (.Site.Params.avatar) }} - {{ $avatarResized := $avatar.Resize "300x300" }} - - {{ .Site.Params.emoji }} -
+ {{ if .Site.Params.avatar }} +
+ {{ $avatar := resources.Get (.Site.Params.avatar) }} + {{ $avatarResized := $avatar.Resize "300x300" }} + + {{ .Site.Params.emoji }} +
+ {{ end }}

{{ .Site.Title }}

{{ .Site.Params.subtitle }}

@@ -24,7 +26,9 @@
  • - {{ (resources.Get (delimit (slice "icons/" .Pre ".svg") "")).Content | safeHTML }} + {{ if .Pre }} + {{ (resources.Get (delimit (slice "icons/" .Pre ".svg") "")).Content | safeHTML }} + {{ end }} {{- .Name -}}