From ad5c8f0bb528e6d0da0a20f99997ce971544f4b8 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 20 Oct 2019 21:26:47 +0200 Subject: More refining on twitter cards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- _layouts/default.html | 18 +++++++++--------- _plugins/twitter.rb | 2 ++ images/default.png | Bin 9980 -> 1627 bytes 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index 9ae7643..bf03d37 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -27,16 +27,9 @@ {{ title }} - + {% capture description %}{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}{% endcapture %} - - - {% comment %}{% endcomment %} - - - - - + {% comment %}{% endcomment %} {% if site.lang == "ca" %} @@ -51,6 +44,13 @@ + + {% comment %}{% endcomment %} + + + + + {% render_og_image %} {% comment %}{% endcomment %} diff --git a/_plugins/twitter.rb b/_plugins/twitter.rb index 2c9cbfd..e65831b 100644 --- a/_plugins/twitter.rb +++ b/_plugins/twitter.rb @@ -25,6 +25,8 @@ module Jekyll img = normalize(context["raw_title"]) + ".png" path = image_exists?(img) ? "/images/posts/#{img}" : DEFAULT_PATH render_meta("og:image", "http://jo.mssola.com#{path}") + + render_meta("og:image:width", 630) + + render_meta("og:image:height", 315) + render_meta("twitter:image", "http://jo.mssola.com#{path}", name: true) end diff --git a/images/default.png b/images/default.png index 8a85866..bc21f1c 100644 Binary files a/images/default.png and b/images/default.png differ -- cgit v1.2.3