Merge pull request #28 from MrSenko/og_image

Update meta tags and add support for og:image
This commit is contained in:
Gilson Filho
2016-02-19 23:04:08 -02:00
3 changed files with 43 additions and 11 deletions

View File

@ -5,28 +5,56 @@
{{ super() }}
{% for keyword in article.keywords %}
<meta name="keywords" contents="{{keyword}}" />
<meta name="keywords" content="{{keyword}}" >
{% endfor %}
{% for description in article.description %}
<meta name="description" contents="{{description}}" />
{% if description %}
<meta name="description" content="{{ description }}">
{% elif article.headline %}
<meta name="description" content="{{ article.headline }}">
{% elif article.summary %}
<meta name="description" content="{{ article.summary|striptags|truncate(140) }}">
{% endif %}
{% for author in article.authors %}
<meta name="author" content="{{ author }}">
{% endfor %}
{% for tag in article.tags %}
<meta name="tags" contents="{{tag}}" />
<meta name="tags" content="{{tag}}">
{% endfor %}
{% endblock %}
{% block opengraph %}
{{ super() }}
<meta property="og:type" content="article">
<meta property="article:author" content="{{ author }}">
{% for author in article.authors %}
<meta property="article:author" content="{{ author }}" >
{% endfor %}
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}">
<meta property="og:title" content="{{ article.title }}">
<meta property="og:description" content="{{ article.headline }}">
<meta property="og:image" content="{{ SITEURL }}/{{ article.header_cover }}">
<meta property="article:published_time" content="{{ article.date }}">
{% if description %}
<meta property="og:description" content="{{ description }}">
{% elif article.headline %}
<meta property="og:description" content="{{ article.headline }}">
{% elif article.summary %}
<meta property="og:description" content="{{ article.summary|striptags|truncate(140) }}">
{% endif %}
{% if article.og_image %}
{% if article.og_image|lower|truncate(4, True, '') == "http" %}
<meta property="og:image" content="{{ article.og_image }}">
{% else %}
<meta property="og:image" content="{{ SITEURL }}/{{ article.og_image }}">
{% endif %}
{% elif article.header_cover %}
<meta property="og:image" content="{{ SITEURL }}/{{ article.header_cover }}">
{% elif HEADER_COVER %}
<meta property="og:image" content="{{ SITEURL }}/{{ HEADER_COVER }}">
{% else %}
<meta property="og:image" content="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/post-bg.jpg">
{% endif %}
{% endblock %}
{% block header %}

View File

@ -6,8 +6,6 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
{% if GOOGLE_SITE_VERIFICATION %}
<meta name="google-site-verification" content="{{ GOOGLE_SITE_VERIFICATION }}">