Skip to content

Commit 74cf57a

Browse files
authored
fix(seo): correct social preview image path inside <meta> tag (#1623)
1 parent cfe44f2 commit 74cf57a

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

_includes/img-url.html

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,26 @@
1414

1515
{%- if url -%}
1616
{% unless url contains ':' %}
17-
{%- comment -%} CND URL {%- endcomment -%}
18-
{% assign prefix = site.img_cdn | default: '' %}
19-
2017
{%- comment -%} Add page image path prefix {%- endcomment -%}
2118
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
2219

23-
{% assign url = prefix
24-
| append: '/'
25-
| append: url
26-
| replace: '///', '/'
27-
| replace: '//', '/'
28-
| replace: ':', ':/'
29-
%}
30-
31-
{% if include.absolute %}
32-
{% assign url = site.url | append: site.baseurl | append: url %}
33-
{% else %}
34-
{% assign url = site.baseurl | append: url %}
20+
{%- comment -%} CND URL {%- endcomment -%}
21+
{% if site.img_cdn %}
22+
{% assign url = site.img_cdn
23+
| append: '/'
24+
| append: url
25+
| replace: '///', '/'
26+
| replace: '//', '/'
27+
| replace: ':/', '://'
28+
%}
29+
30+
{% unless site.img_cdn contains ':' %}
31+
{% if include.absolute %}
32+
{% assign url = site.url | append: site.baseurl | append: url %}
33+
{% else %}
34+
{% assign url = site.baseurl | append: url %}
35+
{% endif %}
36+
{% endunless %}
3537
{% endif %}
3638
{% endunless %}
3739
{%- endif -%}

0 commit comments

Comments
 (0)