From 6490b0fcbd1263613b523a6b9154896dcdfce195 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 17 Jan 2021 21:47:11 +0800 Subject: [PATCH] Fix avatar url when `site.baseurl` exists (#253) --- _includes/sidebar.html | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/_includes/sidebar.html b/_includes/sidebar.html index fd32f06..4d7f5dd 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -10,17 +10,16 @@
- - {% assign avatar_url = site.avatar %} - - {% unless avatar_url contains '://' %} - {% if site.img_cdn %} - {% assign avatar_url = avatar_url | prepend: site.img_cdn %} - {% else %} - {% assign avatar_url = avatar_url | relative_url %} - {% endif %} - {% endunless %} - + + {% 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