Skip to content

Commit

Permalink
fix(seo): correct social preview image path inside <meta> tag (#1623)
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 authored Mar 22, 2024
1 parent cfe44f2 commit 74cf57a
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions _includes/img-url.html
Original file line number Diff line number Diff line change
Expand Up @@ -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: ':', ':/'
%}

{% if include.absolute %}
{% assign url = site.url | append: site.baseurl | append: url %}
{% else %}
{% assign url = site.baseurl | append: url %}
{%- comment -%} 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 %}
{% endif %}
{% endunless %}
{%- endif -%}
Expand Down

0 comments on commit 74cf57a

Please sign in to comment.