File tree Expand file tree Collapse file tree 3 files changed +9
-14
lines changed
Expand file tree Collapse file tree 3 files changed +9
-14
lines changed Original file line number Diff line number Diff line change 2222 {% seo title=false %}
2323 {% endcapture %}
2424
25- {% if page.image.path %}
26- {% capture target %}"{{ site.url }}{{ page.image.path | relative_url }}"{% endcapture %}
25+ {% if page.image %}
26+ {% assign img = page.image.path | default: page.image %}
27+ {% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %}
28+ {% capture target %}"{{ img | absolute_url }}"{% endcapture %}
2729
2830 {% if site.img_cdn contains '//' %}
2931 <!-- it's a cross-origin URL -->
30- {% capture replacement %}"{{ site.img_cdn }}{{ page. img_path }}{{ page.image.path }}"{% endcapture %}
32+ {% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %}
3133 {% else %}
3234 <!-- it's a local file path -->
3335 {%- capture replacement -%}
34- "{{ site.url }}{{ site.baseurl }}{{ site.img_cdn }}{{ page. img_path }}{{ page.image.path }}"
36+ "{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}"
3537 {%- endcapture -%}
3638 {% endif %}
3739
3840 {% assign seo_tags = seo_tags | replace: target, replacement %}
39-
4041 {% endif %}
4142
4243 {{ seo_tags }}
Original file line number Diff line number Diff line change 107107
108108 <!-- Add image path -->
109109 {% if page.img_path %}
110- {% assign _path = page.img_path %}
111- {% assign last_char = _path | slice: -1 %}
112-
113- {% unless last_char == '/ ' %}
114- {% assign _path = _path | append: '/' %}
115- {% endunless %}
116-
110+ {% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
117111 {% assign _src_prefix = _src_prefix | append: _path %}
118112 {% endif %}
119113
Original file line number Diff line number Diff line change @@ -26,13 +26,13 @@ <h1 data-toc-skip>{{ page.title }}</h1>
2626 </ span >
2727 {% endif %}
2828
29- {% if page.image.path %}
29+ {% if page.image %}
3030 {% capture bg %}
3131 {% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
3232 {% endcapture %}
3333
3434 < div class ="mt-3 mb-3 ">
35- < img src ="{{ page.image.path }} " class ="preview-img {{ bg | strip }} "
35+ < img src ="{{ page.image.path | default: page.image }} " class ="preview-img {{ bg | strip }} "
3636 alt ="{{ page.image.alt | default: "Preview Image " }}"
3737
3838 {% if page.image.width %}
You can’t perform that action at this time.
0 commit comments