Merge pull request #39 from MrSenko/twitter_cards

Refactor Twitter cards support
This commit is contained in:
Gilson Filho
2016-04-07 14:38:45 -03:00
3 changed files with 41 additions and 43 deletions

View File

@ -79,21 +79,17 @@
<meta property="og:site_name" content="{{ SITENAME }}">
{% endblock opengraph %}
{% block twitter_card %}
{% if TWITTER_HANDLE %}
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@{{ TWITTER_HANDLE }}" />
<meta name="twitter:title" content="{{ SITENAME }}" />
{% if SITESUBTITLE %}
<meta name="twitter:description" content="{{ SITESUBTITLE }}" />
{% else %}
<meta name="twitter:description" content="View the blog." />
{% endif %}
{% for name,link in SOCIAL if name in ['twitter'] %}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@{{ link|replace('http://', 'https://')|replace('https://twitter.com/', '') }}">
<meta name="twitter:title" content="{{ SITENAME }}">
<meta name="twitter:description" content="{{ SITESUBTITLE|default('View the blog.') }}">
{% if HEADER_COVER %}
<meta name="twitter:image" content="{{ SITEURL }}/{{ HEADER_COVER }}">
{% else %}
<meta name="twitter:image" content="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/post-bg.jpg">
{% endif %}
{% endif %}
{% endfor %}
{% endblock twitter_card %}
</head>