Skip to content

Commit b2d1cb6

Browse files
authored
fix: og:image URL is incorrect (#1468)
Introduced by #1463
1 parent 3589a6e commit b2d1cb6

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

_includes/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
2727
{%- capture new_url -%}{{ img_url }}{%- endcapture -%}
2828

29-
{% assign seo_tags = seo_tags | replace: old, new %}
29+
{% assign seo_tags = seo_tags | replace: old_url, new_url %}
3030
{% endunless %}
3131

3232
{% elsif site.social_preview_image %}

_includes/img-url.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@
1212
{% assign url = include.src %}
1313

1414
{%- if url -%}
15-
{%- comment -%} CND URL {%- endcomment -%}
16-
{% assign prefix = site.img_cdn | default: '' | relative_url %}
15+
{% unless url contains ':' %}
16+
{%- comment -%} CND URL {%- endcomment -%}
17+
{% assign prefix = site.img_cdn | default: '' | relative_url %}
1718

18-
{%- comment -%} Add page image path prefix {%- endcomment -%}
19-
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
19+
{%- comment -%} Add page image path prefix {%- endcomment -%}
20+
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
2021

21-
{% assign url = prefix | append: '/' | append: url | replace: '///', '/' | replace: '//', '/' | replace: ':', ':/' %}
22+
{% assign url = prefix
23+
| append: '/'
24+
| append: url
25+
| replace: '///', '/'
26+
| replace: '//', '/'
27+
| replace: ':', ':/'
28+
%}
29+
{% endunless %}
2230
{%- endif -%}
2331

2432
{{- url -}}

0 commit comments

Comments
 (0)