Merge branch 'adsense'
This commit is contained in:
commit
92c0010ba8
3 changed files with 31 additions and 0 deletions
10
README.md
10
README.md
|
@ -25,6 +25,16 @@ The minimalist [Pelican](http://blog.getpelican.com/) theme.
|
|||
- [Piwik](http://piwik.org/)
|
||||
- [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
|
||||
|
||||
The recommend way to install is over [pelican-themes](https://github.com/getpelican/pelican-themes).
|
||||
|
|
12
templates/adsense-banner.html
Normal file
12
templates/adsense-banner.html
Normal 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 %}
|
|
@ -12,6 +12,10 @@
|
|||
{% block content %}
|
||||
<article class="single">
|
||||
<header>
|
||||
|
||||
{% if SHOW_ADSENSE_ARTICLE_TOP %}
|
||||
{% include "adsense-banner.html" %}
|
||||
{% endif %}
|
||||
<h1 id="{{ article.slug }}">{{ article.title }}</h1>
|
||||
<p>
|
||||
{{ _('Posted on %(when)s in %(category)s',
|
||||
|
@ -26,6 +30,11 @@
|
|||
<div>
|
||||
{{ article.content }}
|
||||
</div>
|
||||
|
||||
{% if SHOW_ADSENSE_ARTICLE_BOTTOM %}
|
||||
{% include "adsense-banner.html" %}
|
||||
{% endif %}
|
||||
|
||||
<div class="tag-cloud">
|
||||
<p>
|
||||
{% if article.tags %}
|
||||
|
|
Loading…
Add table
Reference in a new issue