Add support for Google AdSense banners

- Variables for _config.yml
- Includes for sidebar and footer banners
This commit is contained in:
Michael Rose 2014-08-08 16:07:03 -04:00
parent e66117f446
commit edfa40d322
5 changed files with 29 additions and 3 deletions

View file

@ -48,6 +48,6 @@ owner:
plus:
analytics:
verify:
ad-client:
ad-slot:
ad-client:
ad-slot:
bing-verify:

11
_includes/ad-footer.html Normal file
View file

@ -0,0 +1,11 @@
<div class="google-ads" style="margin:10px 0;">
<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- 320x50 ad -->
<ins class="adsbygoogle"
style="display:inline-block;width:320px;height:50px"
data-ad-client="{{ site.owner.google.ad-client }}"
data-ad-slot="{{ site.owner.google.ad-slot }}"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div><!-- /.google-ads -->

11
_includes/ad-sidebar.html Normal file
View file

@ -0,0 +1,11 @@
<div class="google-ads" style="margin-top:40px; text-align:center;">
<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- 160x600 ad -->
<ins class="adsbygoogle"
style="display:inline-block;width:160px;height:600px"
data-ad-client="{{ site.owner.google.ad-client }}"
data-ad-slot="{{ site.owner.google.ad-slot }}"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div><!-- /.google-ads -->

View file

@ -1,3 +1,5 @@
{% if site.owner.google.ad-client and site.owner.google.ad-slot %}{% include ad-footer.html %}{% endif %}
<span>&copy; {{ site.time | date: '%Y' }} {{ site.owner.name }}. Powered by <a href="http://jekyllrb.com">Jekyll</a> using the <a href="http://mademistakes.com/so-simple/">So Simple Theme</a>.</span>
<div class="social-icons">
{% if site.owner.twitter %}<a href="http://twitter.com/{{ site.owner.twitter }}" title="{{ site.owner.name}} on Twitter" target="_blank"><i class="fa fa-twitter-square fa-2x"></i></a>{% endif %}

View file

@ -46,7 +46,9 @@
<span class="social-share-googleplus">
<a href="https://plus.google.com/share?url={{ site.url }}{{ page.url }}" title="Share on Google Plus" itemprop="GooglePlus"><i class="fa fa-google-plus-square"></i> +1</a>
</span>
<!-- /.social-share -->{% endif %}
<!-- /.social-share -->
{% endif %}
{% if page.ads != false %}{% include ad-sidebar.html %}<!-- /.google-ads -->{% endif %}
</footer>
<div class="entry-content">
{{ content }}