_includes/img-url.html in jekyll-theme-chirpy-6.4.2 vs _includes/img-url.html in jekyll-theme-chirpy-6.5.0

- old
+ new

@@ -1,22 +1,23 @@ {%- comment -%} Generate image final URL based on `site.img_cdn`, `page.img_path` Arguments: - src - basic image path, required - img_path - relative path of image, optional + src - required, basic image path + img_path - optional, relative path of image + absolute - optional, boolean, if true, generate absolute URL Return: image URL {%- endcomment -%} {% assign url = include.src %} {%- if url -%} {% unless url contains ':' %} {%- comment -%} CND URL {%- endcomment -%} - {% assign prefix = site.img_cdn | default: '' | relative_url %} + {% 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 @@ -24,9 +25,15 @@ | append: url | replace: '///', '/' | replace: '//', '/' | replace: ':', ':/' %} + + {% if include.absolute %} + {% assign url = url | absolute_url %} + {% else %} + {% assign url = url | relative_url %} + {% endif %} {% endunless %} {%- endif -%} {{- url -}}