diff --git a/_includes/img-url.html b/_includes/img-url.html
index 2f8d401..20620b7 100644
--- a/_includes/img-url.html
+++ b/_includes/img-url.html
@@ -14,24 +14,26 @@
{%- if url -%}
{% unless url contains ':' %}
- {%- comment -%} CND URL {%- endcomment -%}
- {% assign prefix = site.img_cdn | default: '' %}
-
{%- comment -%} Add page image path prefix {%- endcomment -%}
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
- {% assign url = prefix
- | append: '/'
- | append: url
- | replace: '///', '/'
- | replace: '//', '/'
- | replace: ':', ':/'
- %}
+ {%- comment -%} CND URL {%- endcomment -%}
+ {% if site.img_cdn %}
+ {% assign url = site.img_cdn
+ | append: '/'
+ | append: url
+ | replace: '///', '/'
+ | replace: '//', '/'
+ | replace: ':/', '://'
+ %}
- {% if include.absolute %}
- {% assign url = site.url | append: site.baseurl | append: url %}
- {% else %}
- {% assign url = site.baseurl | append: url %}
+ {% 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 %}
{% endif %}
{% endunless %}
{%- endif -%}