Refactor Twitter cards support
Remove the TWITTER_HANDLE variable and use the 'twitter' value from SOCIAL. This eliminates duplicate settings! Remove closing slash for meta tags, not required by HTML5, see http://stackoverflow.com/a/21898502 In article.html Twitter images were specified twice - once as relative URL and once as full site URL. Now only a single full URL is used instead. Also stripped HTML tags from description. The default card type is summary_large_image which better displays with high-res images and the default header images. ``twitter_image`` article metadata is now supported, similar to ``og_image``. Documentation is updated.
This commit is contained in:
@ -81,21 +81,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>
|
||||
|
||||
|
Reference in New Issue
Block a user