Some improvement with Schema.org

This commit is contained in:
Luca Chiricozzi 2015-01-09 19:56:22 +01:00
parent 2e337cd80a
commit 1acb6d6f56
5 changed files with 41 additions and 20 deletions

View File

@ -8,18 +8,20 @@
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}" />
<meta name="twitter:title" content="{{ article.title|capitalize }}" />
<meta name="twitter:url" content="{{ SITEURL }}/{{ article.url }}" />
<meta itemprop="url" content="{{ SITEURL }}/{{ article.url }}" />
{% if article.summary %}
<meta property="og:description" content="{{ article.summary|striptags }}" />
<meta name="twitter:description" content="{{ article.summary|striptags }}" />
<meta property="og:description" content="{{ article.summary|striptags|e }}" />
<meta name="twitter:description" content="{{ article.summary|striptags|e }}" />
{% endif %}
{% if article.date %}
<meta property="og:article:published_time" content="{{ article.date }}">
<meta property="og:article:published_time" content="{{ article.date.strftime('%Y-%m-%d') }}" />
{% endif %}
{% if article.modified %}
<meta property="og:article:modified_time" content="{{ article.modified }}">
<meta property="og:article:modified_time" content="{{ article.modified.strftime('%Y-%m-%d') }}">
<meta itemprop="dateModified" content="{{ article.date.strftime('%Y-%m-%d') }}" />
{% endif %}
{% if article.author %}
<meta property="og:article:author" content="{{ article.author }}">
<meta property="og:article:author" content="{{ article.author }}" >
{% endif %}
{% for tag in article.tags %}
<meta property="og:article:tag" content="{{ tag }}">
@ -27,10 +29,12 @@
{% if article.image %}
<meta property="og:image" content="{{ article.image }}" />
<meta name="twitter:image" content="{{ article.image }}" />
<meta itemprop="image" content="{{ article.image }}"/>
{% elif META_IMAGE %}
<meta property="og:image" content="{{ META_IMAGE }}" />
<meta property="og:image:type" content="{{ META_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ META_IMAGE }}" />
<meta itemprop="image" content="{{ META_IMAGE }}" />
{% endif %}
{% endblock %}
@ -58,9 +62,9 @@
<div class="uk-width-medium-7-10">
<article class="uk-article" itemtype="http://schema.org/BlogPosting" itescope="itemscope" itemprop="blogPost">
<article class="uk-article">
<h1 class="uk-heading-large uk-article-title" itemprop="name">{{ article.title }}</h1>
<p class="uk-article-meta"><time datetime="{{ article.date.strftime('%Y-%m-%d') }}" itemprop="datePublished">{{ article.locale_date }}</time> in <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>{% if DISQUS_SITENAME %}, <i class="uk-icon-comment"></i> <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread" itemprop="discussionUrl"></a>{% endif %}</p>
<p class="uk-article-meta"><time datetime="{{ article.date.strftime('%Y-%m-%d') }}" itemprop="datePublished">{{ article.locale_date }}</time> in <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>{% if DISQUS_SITENAME %}, <br class="uk-visible-small"><i class="uk-icon-comment"></i> <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread" itemprop="discussionUrl"></a>{% endif %}</p>
{% if SHARE %}
<a href="https://www.facebook.com/sharer/sharer.php?u={{ SITEURL }}/{{ article.url }}" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');return false;" taget="_blank" class="uk-button uk-visible-small"><i class="uk-icon-facebook-square"></i> Share</a>

View File

@ -1,8 +1,20 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9 lt-ie8 lt-ie7" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if IE 7]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9 lt-ie8" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if IE 8]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="{{ DEFAULT_LANG }}" class="no-js" prefix="og: http://ogp.me/ns#"> <!--<![endif]-->
{% if article %}
<!--[if lt IE 7]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9 lt-ie8 lt-ie7" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/BlogPosting"> <![endif]-->
<!--[if IE 7]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9 lt-ie8" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/BlogPosting"> <![endif]-->
<!--[if IE 8]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/BlogPosting"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="{{ DEFAULT_LANG }}" class="no-js" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/BlogPosting"> <!--<![endif]-->
{% elif page %}
<!--[if lt IE 7]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9 lt-ie8 lt-ie7" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/WebPage"> <![endif]-->
<!--[if IE 7]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9 lt-ie8" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/WebPage"> <![endif]-->
<!--[if IE 8]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/WebPage"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="{{ DEFAULT_LANG }}" class="no-js" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/WebPage"> <!--<![endif]-->
{% else %}
<!--[if lt IE 7]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9 lt-ie8 lt-ie7" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/Blog"> <![endif]-->
<!--[if IE 7]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9 lt-ie8" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/Blog"> <![endif]-->
<!--[if IE 8]> <html lang="{{ DEFAULT_LANG }}" class="no-js lt-ie9" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/Blog"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="{{ DEFAULT_LANG }}" class="no-js" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/Blog"> <!--<![endif]-->
{% endif %}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -20,14 +32,18 @@
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}" />
<meta name="twitter:url" content="{{ SITEURL }}" />
<meta itemprop="name" content="{{ SITENAME }}" />
<meta itemprop="url" content="{{ SITEURL }}"/>
{% if DESCRIPTION %}
<meta property="og:description" content="{{ DESCRIPTION }}" />
<meta name="twitter:description" content="{{ DESCRIPTION }}" />
<meta itemprop="description" content="{{ DESCRIPTION }}" />
{% endif %}
{% if META_IMAGE %}
<meta property="og:image" content="{{ META_IMAGE }}" />
<meta property="og:image:type" content="{{ META_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ META_IMAGE }}" />
<meta itemprop="image" content="{{ META_IMAGE }}" />
{% endif %}
{% endblock %}
<link href="{{ SITEURL }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} ATOM Feed"/>
@ -46,12 +62,6 @@
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="uk-hidden" itemtype="http://schema.org/Blog" itemscope="itemscope">
<meta itemprop="name" content="{{ SITENAME }}" />
<meta itemprop="description" content="{{ DESCRIPTION }}" />
{% if META_IMAGE %}<meta itemprop="image" content="{{ META_IMAGE }}" />{% endif %}
</div>
<header class=" mg-header uk-navbar uk-navbar-attached">
<div class="uk-container uk-container-center">

View File

@ -3,10 +3,13 @@
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}" />
<meta name="twitter:url" content="{{ SITEURL }}" />
<meta itemprop="name" content="{{ SITENAME }}">
<meta itemprop="url" content="{{ SITEURL }}">
{% if META_IMAGE %}
<meta property="og:image" content="{{ META_IMAGE }}" />
<meta property="og:image:type" content="{{ META_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ META_IMAGE }}" />
<meta itemprop="image" content="{{ META_IMAGE }}"/>
{% endif %}
{% endblock %}

View File

@ -9,7 +9,7 @@
{% if loop.index == 1 %}
<article class="uk-article" itemtype="http://schema.org/BlogPosting" itemscope="itemscope" itemprop="blogPost">
<a href="{{ SITEURL }}/{{ article.url }}" class="uk-article-title uk-link-muted" itemprop="name">{{ article.title }}</a>
<p class="uk-article-meta"><time datetime="{{ article.date.strftime('%Y-%m-%d') }}" itemprop="datePublished">{{ article.locale_date }}</time><a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>{% if DISQUS_SITENAME %} • <i class="uk-icon-comment"></i> <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread" itemprop="discussionUrl"></a>{% endif %}</p>
<p class="uk-article-meta"><time datetime="{{ article.date.strftime('%Y-%m-%d') }}" itemprop="datePublished">{{ article.locale_date }}</time><a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>{% if DISQUS_SITENAME %} • <br class="uk-visible-small"><i class="uk-icon-comment"></i> <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread" itemprop="discussionUrl"></a>{% endif %}</p>
</p>
<p class="uk-article-lead" itemprop="description">{{ article.summary|striptags }}</p>
<section itemprop="articleBody">{{ article.content }}</section>
@ -19,7 +19,7 @@
{% else %}
<article class="uk-article" itemtype="http://schema.org/BlogPosting" itemscope="itemscope" itemprop="blogPost">
<a href="{{ SITEURL }}/{{ article.url }}" class="uk-article-title uk-link-muted" itemprop="name">{{ article.title }}</a>
<p class="uk-article-meta"><time datetime="{{ article.date.strftime('%Y-%m-%d') }}" itemprop="datePublished">{{ article.locale_date }}</time><a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>{% if DISQUS_SITENAME %} • <i class="uk-icon-comment"></i> <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread" itemprop="discussionUrl"></a>{% endif %}</p>
<p class="uk-article-meta"><time datetime="{{ article.date.strftime('%Y-%m-%d') }}" itemprop="datePublished">{{ article.locale_date }}</time><a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>{% if DISQUS_SITENAME %} • <br class="uk-visible-small"><i class="uk-icon-comment"></i> <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread" itemprop="discussionUrl"></a>{% endif %}</p>
</p>
<p class="uk-article-lead" itemprop="description">{{ article.summary|striptags }}</p>
<p>{{ ' '.join(article.content.split(' ')[0:100])|striptags }}...</p>

View File

@ -7,23 +7,27 @@
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}/{{ page.url }}" />
<meta name="twitter:url" content="{{ SITEURL }}/{{ page.url }}" />
<meta itemprop="url" content="{{ SITEURL }}/{{ page.url }}"/>
{% if page.image %}
<meta property="og:image" content="{{ page.image }}" />
<meta name="twitter:image" content="{{ page.image }}" />
<meta itemprop="image" content="{{ page.image }}">
{% elif META_IMAGE %}
<meta property="og:image" content="{{ META_IMAGE }}" />
<meta property="og:image:type" content="{{ META_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ META_IMAGE }}" />
<meta itemprop="image" content="{{ SITEURL }}/{{ META_IMAGE }}"/>
{% endif %}
{% if page.summary %}
<meta property="og:description" content="{{ page.summary|striptags }}" />
<meta name="twitter:description" content="{{ page.summary|striptags }}" />
<meta itemprop="description" content="{{ page.summary|striptags }}"/>
{% endif %}
{% endblock %}
{% block content %}
<div class="uk-width-medium-4-5">
<h1 class="uk-heading-large">{{ page.title }}</h1>
<h1 class="uk-heading-large" itemprop="name">{{ page.title }}</h1>
{% block page_content %}
{% endblock %}