Compare commits

...

1 commit

Author SHA1 Message Date
Gustavo Furtado de Oliveira Alves
5360d3f5f0 Support for responsive adsense banners (#56)
Adsense Banners begin
2016-11-01 02:05:22 -02:00
5 changed files with 79 additions and 0 deletions

View file

@ -25,6 +25,23 @@ The minimalist [Pelican](http://blog.getpelican.com/) theme.
- [Piwik](http://piwik.org/)
- [StatusCake](https://www.statuscake.com/)
## Adsense banner
The theme supports responsive adsense banners on the top/bottom of articles and index. And a 250x250 banner in aside.
To configure it create a responsive banner and a 250x250 banner on your adsense account and set this on your pelicanconf.
```javascript
ADSENSE = {
'adClientId' : '<< YOUR AD CLIENT>>',
'adSlot' : {
'aside_250x250' : '<< AD-SLOT FOR THE 250X250 BANNER >>',
'articleBottom_responsible' : '<< AD-SLOT FOR THE RESPONSIBLE BANNER >>',
'top_responsible' : '<< AD-SLOT FOR THE RESPONSIBLE BANNER >>',
'homeBottom_responsible' : '<< AD-SLOT FOR THE RESPONSIBLE BANNER >>'
}
}
```
## Install
The recommend way to install is over [pelican-themes](https://github.com/getpelican/pelican-themes).

View file

@ -12,6 +12,7 @@
{% block content %}
<article class="single">
<header>
<h1 id="{{ article.slug }}">{{ article.title }}</h1>
<p>
{{ _('Posted on %(when)s in %(category)s',
@ -26,6 +27,19 @@
<div>
{{ article.content }}
</div>
{% if ADSENSE.adClientId and ADSENSE.adSlot.articleBottom_responsible %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="{{ ADSENSE.adClientId }}"
data-ad-slot="{{ ADSENSE.adSlot.articleBottom_responsible }}"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}
<div class="tag-cloud">
<p>
{% if article.tags %}

View file

@ -97,8 +97,34 @@
{% endfor %}
</ul>
</div>
{% if ADSENSE.adClientId and ADSENSE.adSlot.aside_250x250 %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- GF - Aside -->
<ins class="adsbygoogle"
style="display:inline-block;width:250px;height:250px"
data-ad-client="{{ ADSENSE.adClientId }}"
data-ad-slot="{{ ADSENSE.adSlot.aside_250x250 }}"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}
</aside>
<main>
{% if ADSENSE.adClientId and ADSENSE.adSlot.top_responsible %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="{{ ADSENSE.adClientId }}"
data-ad-slot="{{ ADSENSE.adSlot.top_responsible }}"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}
{% if MAIN_MENU %}
<nav>
<a href="{{ SITEURL }}">{{ _('Home') }}</a>

View file

@ -37,5 +37,17 @@
</article>
{% endfor %}
{% if ADSENSE.adClientId and ADSENSE.adSlot.homeBottom_responsible %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="{{ ADSENSE.adClientId }}"
data-ad-slot="{{ ADSENSE.adSlot.homeBottom_responsible }}"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}
{% include "partial/pagination.html" %}
{% endblock %}

View file

@ -77,3 +77,13 @@ GOOGLE_ANALYTICS = "UA-XXXXXX-X"
ADD_THIS_ID = 'ra-XX3242XX'
USE_LESS = True
ADSENSE = {
'adClientId' : 'ca-pub-XXXXXXXXXXXXXXXX',
'adSlot' : {
'aside_250x250' : 'YYYYYYYYYY',
'articleBottom_responsible' : 'XXXXXXXXXX',
'top_responsible' : 'XXXXXXXXXX',
'homeBottom_responsible' : 'XXXXXXXXXX'
}
}