diff --git a/_includes/media-url.html b/_includes/media-url.html index 407d42187..ea4107502 100644 --- a/_includes/media-url.html +++ b/_includes/media-url.html @@ -15,9 +15,7 @@ {%- if url -%} {% unless url contains ':' %} {%- comment -%} Add media resources subpath prefix {%- endcomment -%} - {% if include.subpath %} - {% assign url = include.subpath | append: '/' | append: url %} - {% endif %} + {% assign url = include.subpath | default: '' | append: '/' | append: url %} {%- comment -%} Prepend CND URL {%- endcomment -%} {% if site.cdn %} diff --git a/_layouts/default.html b/_layouts/default.html index a55bfefe9..f36c6057b 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -25,7 +25,7 @@ layout: compress
- {% if layout.refactor or layout.layout == 'default' %} + {% if layout.layout == 'default' %} {% include refactor-content.html content=content lang=lang %} {% else %} {{ content }} diff --git a/_layouts/home.html b/_layouts/home.html index cb9ab244d..0161ad8fd 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -1,6 +1,5 @@ --- layout: default -refactor: true --- {% include lang.html %} @@ -55,19 +54,39 @@ refactor: true {% if post.image %} {% assign src = post.image.path | default: post.image %} - {% capture src %}{% include media-url.html src=src subpath=post.media_subpath %}{% endcapture %} + + {% if post.media_subpath %} + {% unless src contains '://' %} + {% assign src = post.media_subpath + | append: '/' + | append: src + | replace: '///', '/' + | replace: '//', '/' + %} + {% endunless %} + {% endif %} + + {% if post.image.lqip %} + {% assign lqip = post.image.lqip %} + + {% if post.media_subpath %} + {% unless lqip contains 'data:' %} + {% assign lqip = post.media_subpath + | append: '/' + | append: lqip + | replace: '///', '/' + | replace: '//', '/' + %} + {% endunless %} + {% endif %} + + {% assign lqip_attr = 'lqip="' | append: lqip | append: '"' %} + {% endif %} {% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %} - {% assign lqip = null %} - - {% if post.image.lqip %} - {% capture lqip_url %}{% include media-url.html src=post.image.lqip subpath=post.media_subpath %}{% endcapture %} - {% assign lqip = 'lqip="' | append: lqip_url | append: '"' %} - {% endif %} -
- {{ alt }} + {{ alt }}
{% assign card_body_col = '7' %} diff --git a/_layouts/post.html b/_layouts/post.html index c8c21ef79..698c86cf6 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,6 +1,5 @@ --- layout: default -refactor: true panel_includes: - toc tail_includes: