add Twitter cards + opengraph

This commit is contained in:
Jörg Thalheim 2013-02-04 23:50:52 +01:00
parent 0dd8b76f8a
commit d674b69ae3
2 changed files with 19 additions and 16 deletions

View File

@ -1,4 +1,3 @@
{% include custom/richobject.html %}
{% if site.flattr_user %}
<script type="text/javascript">
/* <![CDATA[ */
@ -15,3 +14,22 @@
{% include flattr_param.html %}
<link rel="payment" href="https://flattr.com/submit/auto?{{ flattr_param }}" type="text/html" />
{% endif %}
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %}
{% capture ogtype %}{% if page.title %}article{% else %}blog{% endif %}{% endcapture %}
<!-- twitter card -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@Mic_92">
<meta name="twitter:creator" content="@Mic_92">
<meta name="twitter:title" content="{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}">
<meta name="twitter:url" content="{{ canonical }}">
<meta name="twitter:description" content="{{ description | strip_html | condense_spaces | truncate:150 }}">
<!-- open graph -->
<meta property="og:title" content="{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}"/>
<meta property="og:type" content="{{ ogtype }}"/>
<meta property="og:url" content="{{ canonical }}"/>
<meta property="og:site_name" content="Blog of Jörg Thalheim (~/git/blog)"/>
<meta property="og:description" content="{{ description | strip_html | condense_spaces | truncate:150 }}"/>

View File

@ -1,15 +0,0 @@
<meta property="og:url" value="{{ site.url }}{{ page.url }}">
<meta property="og:type" content="blog" />
{% if page.title %}
<meta property="og:title" value="{{ page.title }}">
<meta property="og:description" value="{{ page.description }}">
{% if page.cover %}
<meta property="og:image" value="{{ site.url }}{{ page.cover }}">
{% endif %}
{% else %}
<meta property="og:title" value="{{ site.title }}">
<meta property="og:description" value="{{ site.description }}">
{% if site.cover %}
<meta property="og:image" value="{{ site.url }}{{ site.cover }}">
{% endif %}
{% endif %}