Some SEO improvement

This commit is contained in:
Luca Chiricozzi 2015-01-01 21:06:34 +01:00
parent e725e3b638
commit 036c3266a5
11 changed files with 138 additions and 81 deletions

View File

@ -2,17 +2,19 @@
{% block title %}Archives{% endblock %}
{% block description %}{% endblock %}
{% include 'common_seo.html' %}
{% block content %}
<div class="uk-width-medium-4-5">
<h1 class="uk-heading-large">Archives</h1>
{% for article in dates %}
<article class="uk-article">
<a href="{{ article.url }}" class="uk-article-title uk-link-muted">{{ article.title }}</a>
<article class="uk-article" itemtype="http://schema.org/BlogPosting" itemscope="itemscope" itemprop="blogPost">
<a href="{{ article.url }}" class="uk-article-title uk-link-muted" itemprop="name url">{{ article.title }}</a>
<p class="uk-article-meta">
<time datetime="{{ article.date.strftime('%Y-%m-%d') }}">{{ article.locale_date }}</time>
<time datetime="{{ article.date.strftime('%Y-%m-%d') }}" itemprop="datePublished">{{ article.locale_date }}</time>
</p>
<p class="uk-article-lead">{{ article.summary }}</p>
<p class="uk-article-lead" itemprop="description">{{ article.summary }}</p>
<hr class="uk-article-divider">
</article>
{% endfor %}

View File

@ -1,6 +1,40 @@
{% extends "base.html" %}
{% block title %}{{ article.title|striptags }}{% endblock %}
{% block description %}{{ article.summary|striptags }}{% endblock %}
{% block seo %}
<meta property="og:title" content="{{ article.title|capitalize }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}" />
<meta name="twitter:title" content="{{ article.title|capitalize }}" />
<meta name="twitter:url" content="{{ SITEURL }}/{{ article.url }}" />
{% if article.summary %}
<meta property="og:description" content="{{ article.summary }}" />
<meta name="twitter:description" content="{{ article.summary }}" />
{% endif %}
{% if article.date %}
<meta property="og:article:published_time" content="{{ article.date }}">
{% endif %}
{% if article.modified %}
<meta property="og:article:modified_time" content="{{ article.modified }}">
{% endif %}
{% if article.author %}
<meta property="og:article:author" content="{{ article.author }}">
{% endif %}
{% for tag in article.tags %}
<meta property="og:article:tag" content="{{ tag }}">
{% endfor %}
{% if article.image %}
<meta property="og:image" content="{{ SITEURL }}/static/{{ article.image }}" />
<meta name="twitter:image" content="{{ SITEURL }}/static/{{ article.image }}" />
{% elif OG_IMAGE%}
<meta property="og:image" content="{{ SITEURL }}/static/{{ OG_IMAGE }}" />
<meta property="og:image:type" content="{{ OG_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ SITEURL }}/static/{{ OG_IMAGE }}" />
{% endif %}
{% endblock %}
{% block content %}
<div class="mg-container-social uk-width-medium-1-10 uk-hidden-small">
@ -24,7 +58,7 @@
<div class="uk-width-medium-7-10">
<article class="uk-article" itemscope itemtype="http://schema.org/BlogPosting">
<article class="uk-article" itemtype="http://schema.org/BlogPosting" itescope="itemscope" itemprop="blogPost">
<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>
@ -35,7 +69,7 @@
{% endif %}
<p class="uk-article-lead" itemprop="description">{{ article.summary|striptags }}</p>
<div itemprop="articleBody">{{ article.content }}</div>
<section itemprop="articleBody">{{ article.content }}</section>
<hr class="uk-article-divider">
</article>

View File

@ -1,3 +1,5 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME }} | {{ author }}{% endblock %}
{% block title %}{{ author }}{% endblock %}
{% block description %}{% endblock %}
{% include 'common_seo.html' %}

View File

@ -1,87 +1,54 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" prefix="og: http://ogp.me/ns#"> <!--<![endif]-->
<!--[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]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% block title %}{{ SITENAME }}{%endblock%}</title>
<title>{% block title %}{{ SITENAME }}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{% block description %}{{ SITE_DESCRIPTION }}{% endblock %}">
<meta name="description" content="{% block description %}{{ DESCRIPTION }}{% endblock %}">
<link rel="shortcut icon" href="{{ SITEURL}}/favicon.ico" type="image/vnd.microsoft.icon">
<meta name="author" content="{{ AUTHOR }}">
<meta name="copyright" content="{{ AUTHOR }}">
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="{{ TWITTER_USERNAME }}" />
<meta property="og:site_name" content="{{ SITENAME }}" />
{% if article %}
<meta property="og:title" content="{{ article.title|capitalize }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}" />
<meta name="twitter:title" content="{{ article.title|capitalize }}" />
<meta name="twitter:url" content="{{ SITEURL }}/{{ article.url }}" />
{% if article.summary %}
<meta property="og:description" content="{{ article.summary }}" />
<meta name="twitter:description" content="{{ article.summary }}" />
{% endif %}
{% if article.date %}
<meta property="og:article:published_time" content="{{ article.date }}">
{% endif %}
{% if article.modified %}
<meta property="og:article:modified_time" content="{{ article.modified }}">
{% endif %}
{% if article.author %}
<meta property="og:article:author" content="{{ article.author }}">
{% endif %}
{% for tag in article.tags %}
<meta property="og:article:tag" content="{{ tag }}">
{% endfor %}
{% if article.image %}
<meta property="og:image" content="{{ SITEURL }}/static/{{ article.image }}" />
<meta name="twitter:image" content="{{ SITEURL }}/static/{{ article.image }}" />
{% endif %}
{% elif page %}
<meta property="og:title" content="{{ page.title|capitalize }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}/{{ page.url }}" />
<meta name="twitter:url" content="{{ SITEURL }}/{{ page.url }}" />
{% if page.image %}
<meta property="og:image" content="{{ SITEURL }}/static/{{ page.image }}" />
<meta name="twitter:image" content="{{ SITEURL }}/static/{{ page.image }}" />
{% endif %}
{% if page.summary %}
<meta property="og:description" content="{{ page.summary }}" />
<meta name="twitter:description" content="{{ page.summary }}" />
{% endif %}
{% else %}
{% block seo %}
<meta property="og:title" content="{{ SITENAME }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}" />
<meta name="twitter:url" content="{{ SITEURL }}" />
{% if SITE_DESCRIPTION %}
<meta property="og:description" content="{{ SITE_DESCRIPTION }}" />
<meta name="twitter:description" content="{{ SITE_DESCRIPTION }}" />
{% if DESCRIPTION %}
<meta property="og:description" content="{{ DESCRIPTION }}" />
<meta name="twitter:description" content="{{ DESCRIPTION }}" />
{% endif %}
{% if OG_IMAGE %}
<meta property="og:image" content="{{ SITEURL }}/static/{{ OG_IMAGE }}" />
<meta property="og:image:type" content="{{ OG_IMAGE_TYPE }}" />
<meta name="twitter:image" content={{ SITEURL }}/static/{{ OG_IMAGE }}"" />
<meta name="twitter:image" content="{{ SITEURL }}/static/{{ OG_IMAGE }}" />
{% endif %}
{% endif %}
<link href="{{ SITEURL }}/{{ FEED_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} ATOM Feed"/>
{% endblock %}
<link href="{{ SITEURL }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} ATOM Feed"/>
<link href='//fonts.googleapis.com/css?family=Open+Sans:800italic' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/uikit/2.15.0/css/uikit.min.css">
<link rel="stylesheet" href="/theme/css/solarized.css">
<link rel="stylesheet" href="/theme/css/main.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<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 }}" />
</div>
<header class=" mg-header uk-navbar uk-navbar-attached">
<div class="uk-container uk-container-center">
@ -131,7 +98,7 @@
<div class="uk-panel uk-panel-box">
<h3 class="uk-panel-title">Receive Updates</h3>
<a rel="alternate" type="application/atom+xml" href="{{ SITEURL }}/{{ FEED_ATOM}}" class="mg-feed"><i class="uk-icon-rss uk-icon-medium"></i> ATOM</a>
<a rel="alternate" type="application/atom+xml" href="{{ SITEURL }}/{{ FEED_ALL_ATOM }}" class="mg-feed"><i class="uk-icon-rss uk-icon-medium"></i> ATOM</a>
</div>
{% if SOCIAL %}
@ -157,7 +124,7 @@
<div class="uk-container uk-container-center uk-text-center">
<div class="mg-icons-small uk-subnav uk-visible-small">
<li><a rel="alternate" type="application/atom+xml" href="{{ SITEURL }}/{{ FEED_ATOM }}" class="uk-icon-button uk-icon-rss"></a></li>
<li><a rel="alternate" type="application/atom+xml" href="{{ SITEURL }}/{{ FEED_ALL_ATOM }}" class="uk-icon-button uk-icon-rss"></a></li>
{% if SOCIAL %}
{% for icon, link in SOCIAL %}
<li>
@ -170,7 +137,7 @@
<div class="mg-author uk-panel">
<p>{{ FOOTER }}</p>
<p>Powered by <a href="http://blog.getpelican.com">Pelican</a>. Theme <a href="https://github.com/lucachr/pelican-mg">mg</a> by <a href="https://github.com/lucachr">Luca Chiricozzi</a>.</p>
<p>Powered by <a href="http://blog.getpelican.com">Pelican</a>.<br class="uk-visible-small"> Theme <a href="https://github.com/lucachr/pelican-mg">mg</a> by <a href="https://github.com/lucachr">Luca Chiricozzi</a>.</p>
</div>
</div>
</footer>

View File

@ -2,6 +2,8 @@
{% block title %}Categories{% endblock %}
{% block description %}{% endblock %}
{% include 'common_seo.html' %}
{% block content %}
<div class="uk-width-medium-4-5">
<h1>Categories</h1>

View File

@ -1,3 +1,5 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME }} | {{ category|capitalize }}{% endblock %}
{% block title %}{{ category|capitalize }}{% endblock %}
{% block description %}{% endblock %}
{% include 'common_seo.html' %}

13
templates/common_seo.html Normal file
View File

@ -0,0 +1,13 @@
{% block seo %}
<meta property="og:title" content="{{ SITENAME }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}" />
<meta name="twitter:url" content="{{ SITEURL }}" />
{% if OG_IMAGE %}
<meta property="og:image" content="{{ SITEURL }}/static/{{ OG_IMAGE }}" />
<meta property="og:image:type" content="{{ OG_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ SITEURL }}/static/{{ OG_IMAGE }}" />
{% endif %}
{% endblock %}

View File

@ -6,17 +6,30 @@
{% if articles %}
{% for article in articles %}
<article class="uk-article">
<a href="{{ SITEURL }}/{{ article.url }}" class="uk-article-title uk-link-muted">{{ article.title }}</a>
<p class="uk-article-meta"><time datetime="{{ article.date.strftime('%Y-%m-%d') }}">{{ 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"></a>{% endif %}</p>
{% 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>
<p class="uk-article-lead">{{ article.summary|striptags }}</p>
<p class="uk-article-lead" itemprop="description">{{ article.summary|striptags }}</p>
<section itemprop="articleBody">{{ article.content }}</section>
<a href="{{ SITEURL }}/{{ article.url }}#disqus_thread"></a>
<hr class="uk-article-divider">
</article>
{% 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>
<p class="uk-article-lead" itemprop="description">{{ article.summary|striptags }}</p>
<p>{{ ' '.join(article.content.split(' ')[0:100])|striptags }}...</p>
<a href="{{ SITEURL }}/{{ article.url }}">Read More</a>
<hr class="uk-article-divider">
</article>
{% endif %}
{% if DEFAULT_PAGINATION and articles_paginator.num_pages > 1 %}
{% endfor %}
{% if DEFAULT_PAGINATION and articles_paginator.num_pages > 1 %}
<ul class="uk-pagination">
{% if articles_previous_page %}<li><a href="{{ SITEURL }}/{{ articles_previous_page.url }}"><i class="uk-icon-angle-double-left"></i></a></li>{% endif %}
{% if articles_previous_page %}<li><a href="{{ SITEURL }}/{{ articles_previous_page.url }}">{{ articles_previous_page.number }}</a></li>{% endif %}
@ -24,8 +37,8 @@
{% if articles_next_page %}<li><a href="{{ SITEURL }}/{{ articles_next_page.url }}"><i class="uk-icon-angle-double-right"></i></a></li>{% endif %}
{% if articles_next_page %}<li><a href="{{ SITEURL }}/{{ articles_next_page.url }}">{{ articles_next_page.number }}</a></li>{% endif %}
</ul>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,6 +1,26 @@
{% extends "base.html" %}
{% block title %}{{ page.title|capitalize }}{% endblock %}
{% block description %}{% endblock %}
{% block seo %}
<meta property="og:title" content="{{ page.title|capitalize }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}/{{ page.url }}" />
<meta name="twitter:url" content="{{ SITEURL }}/{{ page.url }}" />
{% if page.image %}
<meta property="og:image" content="{{ SITEURL }}/static/{{ page.image }}" />
<meta name="twitter:image" content="{{ SITEURL }}/static/{{ page.image }}" />
{% elif OG_IMAGE %}
<meta property="og:image" content="{{ SITEURL }}/static/{{ OG_IMAGE }}" />
<meta property="og:image:type" content="{{ OG_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ SITEURL }}/static/{{ OG_IMAGE }}" />
{% endif %}
{% if page.summary %}
<meta property="og:description" content="{{ page.summary }}" />
<meta name="twitter:description" content="{{ page.summary }}" />
{% endif %}
{% endblock %}
{% block content %}
<div class="uk-width-medium-4-5">
<h1 class="uk-heading-large">{{ page.title }}</h1>
@ -10,6 +30,4 @@
{{ page.content }}
</div>
{% endblock %}

View File

@ -1,3 +1,5 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME }} | {{ tag|capitalize }}{% endblock %}
{% block description %}{% endblock %}
{% include 'common_seo.html' %}

View File

@ -2,6 +2,8 @@
{% block title %}Tags{% endblock %}
{% block description %}{% endblock %}
{% include 'common_seo.html' %}
{% block content %}
<div class="uk-width-medium-4-5">
<h1 class="uk-heading-large">Tags</h1>