From a887f1d57d9ac8e08c789c6201147bf68c459573 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 30 Sep 2021 15:24:10 +0800 Subject: [PATCH] Prevent the site test from failing when the avatar is not assigned (close #418) Some rookies like to do this :( --- _includes/sidebar.html | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/_includes/sidebar.html b/_includes/sidebar.html index 4ab9f12..5fd3eb0 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -6,16 +6,18 @@
- {% capture avatar_url %} - {%- if site.avatar contains '://' -%} - {{ site.avatar }} - {%- elsif site.img_cdn != '' and site.img_cdn -%} - {{ site.avatar | prepend: site.img_cdn }} - {%- else -%} - {{ site.avatar | relative_url }} - {%- endif -%} - {% endcapture %} - avatar + {% if site.avatar != '' and site.avatar %} + {% capture avatar_url %} + {%- if site.avatar contains '://' -%} + {{ site.avatar }} + {%- elsif site.img_cdn != '' and site.img_cdn -%} + {{ site.avatar | prepend: site.img_cdn }} + {%- else -%} + {{ site.avatar | relative_url }} + {%- endif -%} + {% endcapture %} + avatar + {% endif %}