aboutsummaryrefslogtreecommitdiff
path: root/_layouts
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2019-10-20 20:44:43 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2019-10-20 20:44:43 +0200
commit420e822c8f52370bc063c8ab9df417a9a3d211bf (patch)
tree52c16fa69221e6780277de55a87897f44557fa16 /_layouts
parent0f8f87877ef744f8006aa86406d3d4ab3e07ef94 (diff)
downloadjo.mssola.com-420e822c8f52370bc063c8ab9df417a9a3d211bf.tar.gz
jo.mssola.com-420e822c8f52370bc063c8ab9df417a9a3d211bf.zip
Added meta tags into the default layout
This also includes a small Jekyll plugin that automatically guesses the OG image to be used depending on the availability of a thumbnail image. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '_layouts')
-rw-r--r--_layouts/default.html34
1 files changed, 30 insertions, 4 deletions
diff --git a/_layouts/default.html b/_layouts/default.html
index 0adbf0d..2b452db 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -14,16 +14,42 @@
{% endcomment %}
{% if page.title %}
{% if page.title contains "titles." %}
- <title>{{ site.title }} - {% t page.title %}</title>
+ {% capture title %}{{ site.title }} - {% t page.title %}{% endcapture %}
+ {% capture raw_title %}{% t page.title %}{% endcapture %}
{% else %}
- <title>{{ site.title }} - {{ page.title }}</title>
+ {% capture title %}{{ site.title }} - {{ page.title }}{% endcapture %}
+ {% capture raw_title %}{{ page.title }}{% endcapture %}
{% endif %}
{% else %}
- <title>{{ site.title }}</title>
+ {% capture title %}{{ site.title }}{% endcapture %}
+ {% capture raw_title %}{% endcapture %}
{% endif %}
+ <title>{{ title }}</title>
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
+ {% capture description %}{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}{% endcapture %}
+ <meta name="description" content="{{ description }}">
+
+ {% comment %}<!-- Twitter stuff -->{% endcomment %}
+ <meta name="twitter:card" content="summary" />
+ <meta name="twitter:site" content="@miquelssola" />
+ <meta name="twitter:creator" content="@miquelssola" />
+
+ {% comment %}<!-- OpenGraph protocol -->{% endcomment %}
+ {% if site.lang == "ca" %}
+ <meta property="og:locale" content="ca_ES" />
+ <meta property="og:locale:alternate" content="en_US" />
+ <meta property="og:url" content="http://jo.mssola.com{{ page.url }}" />
+ {% else %}
+ <meta property="og:locale" content="en_US" />
+ <meta property="og:locale:alternate" content="ca_ES" />
+ <meta property="og:url" content="http://jo.mssola.com/en{{ page.url }}" />
+ {% endif %}
+ <meta property="og:title" content="{{ title }}" />
+ <meta property="og:description" content="{{ description }}" />
+ <meta property="og:type" content="website" />
+ {% render_og_image %}
{% comment %}<!-- We have the same CSS file for all languages -->{% endcomment %}
<link href="{{ "/stylesheets/main.css" | prepend: site.baseurl_root }}" rel="stylesheet" type="text/css" />