diff --git a/_includes/head.html b/_includes/head.html index 8e3756a..03ab48f 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -22,21 +22,22 @@ {% seo title=false %} {% endcapture %} - {% if page.image.path %} - {% capture target %}"{{ site.url }}{{ page.image.path | relative_url }}"{% endcapture %} + {% if page.image %} + {% assign img = page.image.path | default: page.image %} + {% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %} + {% capture target %}"{{ img | absolute_url }}"{% endcapture %} {% if site.img_cdn contains '//' %} - {% capture replacement %}"{{ site.img_cdn }}{{ page.img_path }}{{ page.image.path }}"{% endcapture %} + {% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %} {% else %} {%- capture replacement -%} - "{{ site.url }}{{ site.baseurl }}{{ site.img_cdn }}{{ page.img_path }}{{ page.image.path }}" + "{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}" {%- endcapture -%} {% endif %} {% assign seo_tags = seo_tags | replace: target, replacement %} - {% endif %} {{ seo_tags }} diff --git a/_includes/refactor-content.html b/_includes/refactor-content.html index 89b9908..6535e91 100644 --- a/_includes/refactor-content.html +++ b/_includes/refactor-content.html @@ -107,13 +107,7 @@ {% if page.img_path %} - {% assign _path = page.img_path %} - {% assign last_char = _path | slice: -1 %} - - {% unless last_char == '/' %} - {% assign _path = _path | append: '/' %} - {% endunless %} - + {% assign _path = page.img_path | append: '/' | replace: '//', '/' %} {% assign _src_prefix = _src_prefix | append: _path %} {% endif %} diff --git a/_layouts/post.html b/_layouts/post.html index 44de48a..18b0503 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -26,13 +26,13 @@ tail_includes: {% endif %} - {% if page.image.path %} + {% if page.image %} {% capture bg %} {% unless page.image.no_bg %}{{ 'bg' }}{% endunless %} {% endcapture %}
-