Prevent the site test from failing when the avatar is not assigned (close #418)

Some rookies like to do this :(
This commit is contained in:
Cotes Chung 2021-09-30 15:24:10 +08:00
parent 945e8d1953
commit a887f1d57d

View file

@ -6,16 +6,18 @@
<div class="profile-wrapper text-center"> <div class="profile-wrapper text-center">
<div id="avatar"> <div id="avatar">
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto"> <a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto">
{% capture avatar_url %} {% if site.avatar != '' and site.avatar %}
{%- if site.avatar contains '://' -%} {% capture avatar_url %}
{{ site.avatar }} {%- if site.avatar contains '://' -%}
{%- elsif site.img_cdn != '' and site.img_cdn -%} {{ site.avatar }}
{{ site.avatar | prepend: site.img_cdn }} {%- elsif site.img_cdn != '' and site.img_cdn -%}
{%- else -%} {{ site.avatar | prepend: site.img_cdn }}
{{ site.avatar | relative_url }} {%- else -%}
{%- endif -%} {{ site.avatar | relative_url }}
{% endcapture %} {%- endif -%}
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'"> {% endcapture %}
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'">
{% endif %}
</a> </a>
</div> </div>