added twitter cards

This commit is contained in:
Marvin Steadfast 2016-02-09 10:07:51 +00:00
parent 59a0a26743
commit c801ffd8f5
6 changed files with 53 additions and 42 deletions

View File

@ -4,8 +4,8 @@ from __future__ import unicode_literals
AUTHOR = 'marvin'
SITENAME = 'xsteadfastx'
SITEURL = ''
SITELOGO = SITEURL + '/theme/img/avatar.png'
FAVICON = SITEURL + '/theme/img/favicon.png'
SITELOGO = '/theme/img/avatar.png'
FAVICON = '/theme/img/favicon.png'
TIMEZONE = "Europe/Berlin"
DESCRIPTION = "the cats are not what they seem"
@ -13,7 +13,7 @@ DESCRIPTION = "the cats are not what they seem"
RELATIVE_URLS = True
GITHUB_URL = 'http://github.com/xsteadfastx/'
TWITTER_NAME = 'xsteadfastx'
TWITTER_NAME = '@xsteadfastx'
FLATTR_USER = 'xsteadfastx'
PDF_GENERATOR = False
REVERSE_CATEGORY_ORDER = True

View File

@ -1,10 +1,11 @@
{% extends "base.html" %}
{% block meta %}
<meta name="author" content="{{ article.author.name }}" />
<meta name="description" content="{{ article.summary|striptags }}" />
<meta name="keywords" content="{{ article.tags|join(', ') }}">
{% include "partial/og_article.html" %}
<meta name="author" content="{{ article.author.name }}" />
<meta name="description" content="{{ article.summary|striptags|e }}" />
<meta name="keywords" content="{{ article.tags|join(', ') }}">
{% include "partial/og_article.html" %}
{% include "partial/twittercards.html" %}
{% endblock %}
{% block title %} &ndash; {{ article.title }}{% endblock %}

View File

@ -22,8 +22,8 @@
<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS">
{% endif %}
{% if FAVICON %}
<link rel="shortcut icon" href="{{ FAVICON }}" type="image/x-icon">
<link rel="icon" href="{{ FAVICON }}" type="image/x-icon">
<link rel="shortcut icon" href="{{ SITEURL }}{{ FAVICON }}" type="image/x-icon">
<link rel="icon" href="{{ SITEURL }}{{ FAVICON }}" type="image/x-icon">
{% endif %}
<meta charset="utf-8" />

View File

@ -1,14 +1,14 @@
{% if OG_LOCALE %}
{% set default_locale = OG_LOCALE %}
{% else %}
{% set default_locale = 'en_US' %}
{% endif %}
<meta property="og:site_name" content="{{ SITENAME }}"/>
<meta property="og:type" content="blog"/>
<meta property="og:title" content="{{ SITENAME }}"/>
<meta property="og:description" content="{{ SITEDESCRIPTION }}"/>
<meta property="og:locale" content="{{ default_locale }}"/>
<meta property="og:url" content="{{ SITEURL }}"/>
{% if SITELOGO %}
<meta property="og:image" content="{{ SITELOGO }}">
{% endif %}
{% if OG_LOCALE %}
{% set default_locale = OG_LOCALE %}
{% else %}
{% set default_locale = 'en_US' %}
{% endif %}
<meta property="og:site_name" content="{{ SITENAME }}"/>
<meta property="og:type" content="blog"/>
<meta property="og:title" content="{{ SITENAME }}"/>
<meta property="og:description" content="{{ SITEDESCRIPTION }}"/>
<meta property="og:locale" content="{{ default_locale }}"/>
<meta property="og:url" content="{{ SITEURL }}"/>
{% if SITELOGO %}
<meta property="og:image" content="{{ SITEURL }}{{ SITELOGO }}">
{% endif %}

View File

@ -1,19 +1,19 @@
{% if OG_LOCALE %}
{% set default_locale = OG_LOCALE %}
{% else %}
{% set default_locale = 'en_US' %}
{% endif %}
<meta property="og:site_name" content="{{ SITENAME }}"/>
<meta property="og:title" content="{{ article.title }}"/>
<meta property="og:description" content="{{ article.summary|striptags }}"/>
<meta property="og:locale" content="{{ article.metadata.get('og_locale', default_locale) }}"/>
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
<meta property="og:type" content="article"/>
<meta property="article:published_time" content="{{ article.date }}"/>
<meta property="article:modified_time" content="{{ article.modified }}"/>
<meta property="article:author" content="{{ SITEURL }}/{{ article.author.url }}">
<meta property="article:section" content="{{ article.category.name }}"/>
{% for tag in article.tags %}
<meta property="article:tag" content="{{ tag.name }}"/>
{% endfor %}
<meta property="og:image" content="{{ article.metadata.get('cover', SITELOGO) }}">
{% if OG_LOCALE %}
{% set default_locale = OG_LOCALE %}
{% else %}
{% set default_locale = 'en_US' %}
{% endif %}
<meta property="og:site_name" content="{{ SITENAME }}"/>
<meta property="og:title" content="{{ article.title }}"/>
<meta property="og:description" content="{{ article.summary|striptags|e }}"/>
<meta property="og:locale" content="{{ article.metadata.get('og_locale', default_locale) }}"/>
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
<meta property="og:type" content="article"/>
<meta property="article:published_time" content="{{ article.date }}"/>
<meta property="article:modified_time" content="{{ article.modified }}"/>
<meta property="article:author" content="{{ SITEURL }}/{{ article.author.url }}">
<meta property="article:section" content="{{ article.category.name }}"/>
{% for tag in article.tags %}
<meta property="article:tag" content="{{ tag.name }}"/>
{% endfor %}
<meta property="og:image" content="{{ SITEURL }}{{ article.metadata.get('cover', SITELOGO) }}">

View File

@ -0,0 +1,10 @@
{% if TWITTER_NAME %}
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="{{ TWITTER_NAME }}">
<meta name="twitter:creator" content="{{ TWITTER_NAME }}">
<meta name="twitter:title" content="{{ article.title }}">
<meta name="twitter:url" content="{{ SITEURL }}/{{ article.url }}">
<meta name="twitter:image" content="{{ SITEURL }}{{ SITELOGO }}">
<meta name="twitter:description" content="{{ article.summary|striptags|e }}">
{% endif %}