Fix avatar url when site.baseurl
exists (#253)
This commit is contained in:
parent
ef1d05d342
commit
6490b0fcbd
1 changed files with 10 additions and 11 deletions
|
@ -10,17 +10,16 @@
|
|||
|
||||
<div class="profile-wrapper text-center">
|
||||
<div id="avatar">
|
||||
<a href="{{ site.baseurl }}/" alt="avatar" class="mx-auto">
|
||||
{% 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 %}
|
||||
|
||||
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto">
|
||||
{% 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 %}
|
||||
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'">
|
||||
</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue