Ghost is a simple opensource blogging platform that still under heavy development by their community. I use Openshift and Ghost Quickstart and updated to latest version. Still it already has many key features for blogger. But there is some lack of features such as, how can we monetize our blog? We have to modify or add a script ourself. This tutorial will guide you there.
First thing first, i assume you already have an adsense account, if not register it for free at Google Adsense site.
After you have an approved google adsense account, create an ad unit. There are several ad units to choose. I prefer create a responsive ad unit, and copy the ad code to be inserted to the script of our ghost site. We are not going to talk much about this ad unit size. This should be clear by the name of each ad unit size.
In this tutorial, we will add adsense ad on top of each of our post. So we need to edit
post.hbs. This file located at our theme folder that we choose. (I use default Casper Theme).
Using ssh, connect to your blog application and go to:
In my case, i use openshift so i have to go to:
and edit that file using vim.
Since we want to show the ads on top of each post, we insert google adsense ad unit below this line:
Save your changes and restart ghost blog application.
You can see the result on this page. Later on, depending on your needs and your theme, you can customize the ad placement where to show the ad. The principal how to add the code should the same. It only need a little understanding on html structure.