Skip to content

Commit

Permalink
Fix og images
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenramon committed Dec 24, 2017
1 parent bec7c0c commit 3b6e94b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
{% if page.thumb_image %}
{% if page.thumb_image contains '://' %}
{% assign thumb_image = page.thumb_image %}
{% else %}
{% assign thumb_image = page.thumb_image | asset_path | absolute_url %}
{% endif %}
{% else %}
{% assign thumb_image = 'og-image.jpg' | asset_path | absolute_url %}
{% endif %}

<head>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>{{ site.name }} | {{ page.title }}</title>
Expand All @@ -19,13 +9,24 @@
<meta property="og:url" content="{{ page.url | absolute_url }}">
<meta property="og:description" content="{{ page.description }}">
<meta property="og:site_name" content="{{ site.name }}">
<meta property="og:image" content="{{ thumb_image }}">

<meta name="twitter:card" content="summary">
<meta name="twitter:url" content="{{ page.url | absolute_url }}">
<meta name="twitter:title" content="{{ page.title | escape }}">
<meta name="twitter:description" content="{{ page.description }}">
<meta name="twitter:image" content="{{ thumb_image }}">

{% if page.thumb_image %}
{% if page.thumb_image contains '://' %}
<meta property="og:image" content="{{ page.thumb_image }}">
<meta name="twitter:image" content="{{ page.thumb_image }}">
{% else %}
<meta property="og:image" content="{{ site.url }}{% asset '{{ page.thumb_image }}' @path %}">
<meta name="twitter:image" content="{{ site.url }}{% asset '{{ page.thumb_image }}' @path %}">
{% endif %}
{% else %}
<meta property="og:image" content="{{ site.url }}{% asset og-image.jpg @path %}">
<meta name="twitter:image" content="{{ site.url }}{% asset og-image.jpg @path %}">
{% endif %}

<link href="{{ 'feed.xml' | absolute_url }}" type="application/rss+xml" rel="alternate" title="{{ site.name }} Last 10 blog posts" />

Expand Down

0 comments on commit 3b6e94b

Please sign in to comment.