1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

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

@@ -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 %}