Skip to content

Commit

Permalink
fix(post): correct the image URLs (cotes2020#1627)
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 authored and kimbob13 committed May 25, 2024
1 parent 78ac2e5 commit 1963fc2
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions _includes/img-url.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,20 @@
{%- comment -%} Add page image path prefix {%- endcomment -%}
{% assign url = include.img_path | default: '' | append: '/' | append: url %}

{%- comment -%} CND URL {%- endcomment -%}
{%- comment -%} Prepend CND URL {%- endcomment -%}
{% if site.img_cdn %}
{% assign url = site.img_cdn
| append: '/'
| append: url
| replace: '///', '/'
| replace: '//', '/'
| replace: ':/', '://'
%}

{% unless site.img_cdn contains ':' %}
{% if include.absolute %}
{% assign url = site.url | append: site.baseurl | append: url %}
{% else %}
{% assign url = site.baseurl | append: url %}
{% endif %}
{% endunless %}
{% assign url = site.img_cdn | append: '/' | append: url %}
{% endif %}

{% assign url = url | replace: '///', '/' | replace: '//', '/' | replace: ':/', '://' %}

{% unless url contains '://' %}
{% if include.absolute %}
{% assign url = site.url | append: site.baseurl | append: url %}
{% else %}
{% assign url = site.baseurl | append: url %}
{% endif %}
{% endunless %}
{% endunless %}
{%- endif -%}

Expand Down

0 comments on commit 1963fc2

Please sign in to comment.