Skip to content

Commit

Permalink
fix(seo): og:image and twitter:image are missing the img_path o…
Browse files Browse the repository at this point in the history
…f the post (#754)

Resolves #754
  • Loading branch information
cotes2020 committed Nov 15, 2022
1 parent ae2669f commit 4a18563
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
{% assign properties = 'og:image,twitter:image' | split: ',' %}

{% for prop in properties %}
{% if site.img_cdn contains '//' %}
{% if site.img_cdn contains '://' %}
<!-- `site.img_cdn` is a cross-origin URL -->
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{% endcapture %}
{% capture replacement %}<meta property="{{ prop }}" content="{{ site.img_cdn }}{% endcapture %}
{% capture replacement %}<meta property="{{ prop }}" content="{{ site.img_cdn }}{{ page.img_path }}{% endcapture %}
{% else %}
<!-- `site.img_cdn` is a local file path -->
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{{ site.baseurl }}{% endcapture %}
{% assign replacement = target | append: site.img_cdn %}
{% assign replacement = target | append: site.img_cdn | append: page.img_path %}
{% endif %}
{% assign seo_tags = seo_tags | replace: target, replacement %}
Expand Down

0 comments on commit 4a18563

Please sign in to comment.