Fixed related URL.

This commit is contained in:
Cotes Chung 2020-01-06 04:11:30 +08:00
parent b534ab74de
commit ff9663f376
2 changed files with 8 additions and 5 deletions

View file

@ -10,11 +10,12 @@
<div id="profile-wrapper" class="d-flex flex-column">
<div id="avatar" class="d-flex justify-content-center">
<a href="{{ site.baseurl }}/" alt="avatar">
{% assign avatar = site.avatar %}
{% if avatar | slice: 0 == '/' %}
{% assign avatar = avatar | prepend: site.baseurl %}
{% assign avatar_url = site.avatar %}
{% capture start %}{{ site.avatar | slice: 0 }}{% endcapture %}
{% if start == '/' %}
{% assign avatar_url = avatar_url | prepend: site.baseurl %}
{% endif %}
<img src="{{ avatar }}">
<img src="{{ avatar_url }}">
</a>
</div>

View file

@ -53,7 +53,9 @@ layout: default
{% endif %}
<!-- Add lozad class into image tags. see: <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% if content contains '<img src=' %}
{{ content | replace: '<img src=', '<img class="lozad" src="/assets/img/commons/loading.png" data-src=' }}
{% capture loading %}{{ "/assets/img/commons/loading.png" | relative_url }}{% endcapture %}
{% assign replacement = '<img class="lozad" src=' | append: loading | append: ' data-src=' %}
{{ content | replace: '<img src=', replacement }}
{% else %}
{{ content }}
{% endif %}