Skip to content

Commit

Permalink
Fix OG tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaspar Naaber committed May 13, 2016
1 parent 81fb800 commit 3a5f608
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions components/open-graph.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{% else %}
{% for article in articles %}
{% if article.data.background.image %}
{% assign og_image = article.data.background.image %}
{% assign og_image = article.data.background %}
{% break %}
{% endif %}
{% endfor %}
Expand All @@ -41,11 +41,13 @@

{% if og_image %}
{% if og_image.image %}
<meta property="og:image" content="{{ og_image.image }}">
{% comment %}"http:" and "https:" strings are removed and readded to ensure that older bg-picker images will have protocol.{% endcomment %}
<meta property="og:image" content="{{ og_image.image | replace_first: "http:", "" | replace_first: "https:", "" | prepend: "https:" }}">
{% if og_image.imagesizes[2].width %}<meta property="og:image:width" content="{{ og_image.imagesizes[2].width }}">{% endif %}
{% if og_image.imagesizes[2].height %}<meta property="og:image:height" content="{{ og_image.imagesizes[2].height }}">{% endif %}
{% elsif og_image.url %}
{% if og_image.url %}<meta property="og:image" content="{{ og_image.url }}">{% endif %}
{% comment %}"http:" and "https:" strings are removed and readded to ensure that older bg-picker images will have protocol.{% endcomment %}
{% if og_image.url %}<meta property="og:image" content="{{ og_image.url | replace_first: "http:", "" | replace_first: "https:", "" | prepend: "https:" }}">{% endif %}
{% if og_image.content_type %}<meta property="og:image:type" content="{{ og_image.content_type }}">{% endif %}
{% if og_image.width %}<meta property="og:image:width" content="{{ og_image.width }}">{% endif %}
{% if og_image.height %}<meta property="og:image:height" content="{{ og_image.height }}">{% endif %}
Expand All @@ -63,4 +65,3 @@
<meta property="og:description" content="{{ description | escape }}">
<meta name="description" content="{{ description | escape }}">
{% endif %}

2 changes: 1 addition & 1 deletion layouts/blog___news.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% include "template-variables" %}
<html class="blog-list-page {% if editmode %}editmode{% else %}public{% endif %}" lang="{{ page.language_code }}">
<head prefix="og: http://ogp.me/ns#">
{% assign blog_listing_page = true %}
{% assign blog_page = true %}
{% include "edicy-tools-variables" %}
{% include "html-head" blog_listing_page: true %}
</head>
Expand Down
2 changes: 1 addition & 1 deletion layouts/front_page.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% include "template-variables" %}
<html class="front-page blog-list-page {% if editmode %}editmode{% else %}public{% endif %}" lang="{{ page.language_code }}">
<head prefix="og: http://ogp.me/ns#">
{% assign blog_listing_page = true %}
{% assign front_page = true %}
{% include "edicy-tools-variables" %}
{% include "html-head" blog_listing_page: true %}
</head>
Expand Down

0 comments on commit 3a5f608

Please sign in to comment.