Optimized the Post layout.

This commit is contained in:
Cotes Chung 2019-12-24 01:36:49 +08:00
parent fc3a19c4d6
commit a71bc50a5c

View file

@ -45,21 +45,17 @@ layout: default
</div> <!-- .post-meta --> </div> <!-- .post-meta -->
{% capture post_content %}
<div class="post-content"> <div class="post-content">
{% if page.image %} {% if page.image %}
<img src="{{ page.image }}"> <img src="{{ page.image }}">
{% endif %} {% endif %}
{{ content }}
</div>
{% endcapture %}
<!-- Add lozad class into image tags. see: <https://github.com/ApoorvSaxena/lozad.js#usage> --> <!-- Add lozad class into image tags. see: <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% if post_content contains '<img src=' %} {% if content contains '<img src=' %}
{{ post_content | replace: '<img src=', '<img class="lozad" src="/assets/img/commons/loading.png" data-src=' }} {{ content | replace: '<img src=', '<img class="lozad" src="/assets/img/commons/loading.png" data-src=' }}
{% else %} {% else %}
{{ post_content }} {{ content }}
{% endif %} {% endif %}
</div>
<div class="post-tail text-muted"> <div class="post-tail text-muted">
<!-- Tags --> <!-- Tags -->