Merge branch 'adsense'

This commit is contained in:
Gustavo 2016-09-14 15:48:50 -03:00
commit 92c0010ba8
3 changed files with 31 additions and 0 deletions

View file

@ -25,6 +25,16 @@ The minimalist [Pelican](http://blog.getpelican.com/) theme.
- [Piwik](http://piwik.org/) - [Piwik](http://piwik.org/)
- [StatusCake](https://www.statuscake.com/) - [StatusCake](https://www.statuscake.com/)
## Adsense banner
The theme support responsive adsense banners on the top/bottom of articles.
To configure it create a responsive banner on your adsense account and set this on your pelicanconf.
ADSENSE_AD_CLIENT = 'YOUR AD CLIENT'
ADSENSE_AD_SLOT = 'YOUR AD SLOT'
SHOW_ADSENSE_ARTICLE_TOP = True/False
SHOW_ADSENSE_ARTICLE_BOTTOM = True/False
## Install ## Install
The recommend way to install is over [pelican-themes](https://github.com/getpelican/pelican-themes). The recommend way to install is over [pelican-themes](https://github.com/getpelican/pelican-themes).

View file

@ -0,0 +1,12 @@
{% if ADSENSE_AD_CLIENT and ADSENSE_AD_SLOT %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="{{ ADSENSE_AD_CLIENT }}"
data-ad-slot="{{ ADSENSE_AD_SLOT }}"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}

View file

@ -12,6 +12,10 @@
{% block content %} {% block content %}
<article class="single"> <article class="single">
<header> <header>
{% if SHOW_ADSENSE_ARTICLE_TOP %}
{% include "adsense-banner.html" %}
{% endif %}
<h1 id="{{ article.slug }}">{{ article.title }}</h1> <h1 id="{{ article.slug }}">{{ article.title }}</h1>
<p> <p>
{{ _('Posted on %(when)s in %(category)s', {{ _('Posted on %(when)s in %(category)s',
@ -26,6 +30,11 @@
<div> <div>
{{ article.content }} {{ article.content }}
</div> </div>
{% if SHOW_ADSENSE_ARTICLE_BOTTOM %}
{% include "adsense-banner.html" %}
{% endif %}
<div class="tag-cloud"> <div class="tag-cloud">
<p> <p>
{% if article.tags %} {% if article.tags %}