chiark / gitweb /
theme: provide social meta tags for pages as well.
authorVladimír Vondruš <mosra@centrum.cz>
Wed, 11 Oct 2017 19:38:46 +0000 (21:38 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Wed, 11 Oct 2017 19:54:40 +0000 (21:54 +0200)
pelican-theme/templates/page.html

index a2c92915206659133a7a6d0ed69f39b0d3d810e8..b760cef4d464785d93151988d9b7a98cf6ce2ad5 100644 (file)
 
 {% block head %}
   {{- super() -}}
+  {% if page.description %}
+  <meta name="description" content="{{ page.description }}" />
+  {% endif %}
+  <meta property="og:title" content="{{ page.title }}" />
+  <meta name="twitter:title" content="{{ page.title }}" />
+  <meta property="og:url" content="{{ page.url }}" />
+  <meta name="twitter:url" content="{{ page.url }}" />
+  <meta property="og:description" content="{{ page.summary|striptags }}" />
+  <meta name="twitter:description" content="{{ page.summary|striptags }}" />
+  {% if page.cover %}
+  <meta property="og:image" content="{{ page.cover|expand_link(page) }}" />
+  <meta name="twitter:card" content="summary_large_image" />
+  <meta name="twitter:image" content="{{ page.cover|expand_link(page) }}" />
+  {% else %}
+  <meta name="twitter:card" content="summary" />
+  {% endif %}
+  <meta property="og:type" content="website" />
   {% if page.css %}
   <link rel="stylesheet" href="{{ page.css|expand_link(page) }}" />
   {% endif %}