How to add ads from google Adsense


Hello guys, I’m trying to add some ads to Ghost, I still have to learn a little how the whole platform works but I have an idea so far.
I looked here but didn’t help

I’m trying to add google Adsense, I tried inserting the whole code in posts.hbs under <section class="post-full-content"> but that didn’t work. I also tried inserting the main script

<script async src="//"></script>
to the default.hbs header, then:

<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>

this other on the bottom of the body and finally on the posts.hbs under <section class="post-full-content"> I placed:

<ins class="adsbygoogle"

As you can probably tell it doesn’t work.

What would be the proper way to insert ads?



It should work, unless you have an ad blocker enabled on your browser.


for some reason it’s not working, also I’m testing the theme with a very basic h1 and it’s not working. I’m writing it in post.hbs

<section class="post-full-content">

And that doesn’t show up at all when I open a post… weird… very very weird… any thoughts?

I’m posting the logs so if someone else has the same question the see what’s up :laughing:

EDIT: I just removed {{content}} and it still shows up… could it be that I’m not editing the correct file? I mean there is only one…

EDIT2: I had to do:

sudo systemctl reload nginx
ghost restart

for the changes to take effect


That happens if the site is in production mode. From the docs:

In production mode, the template files are loaded and cached by the server ready to send to the browser. This means that if you make changes to a *.hbs file, you won’t see those changes reflected unless you restart Ghost. This doesn’t happen in development mode, and so pages will take a little longer to get generated, but it makes creating your theme much easier.
(Theme development guide)


I’ll take a look into it. I pasted the ad code this morning and has not taken effect yet

The question is, how to switch between one and the other and what is the difference?


Production mode is designed to be efficient (i.e. production ready), so there are things like aggressive caching.

Development mode is designed to let you have a ghost installation similar to a playground, so it’s less efficient to promote comfort - i.e. less caching -> changes you make show up almost instantly

Because of the way ghost runs, you generally shouldn’t switch an instance between development and production mode, especially since installing a local version is usually painless, but you’re more than welcome to. You just need to tell ghost to use the development config - ghost start -D will run ghost in development mode

If you don’t want to restart ghost every time you make changes, you can upload a zip of your theme in the settings/design panel and ghost will internally reload the components that need to be refreshed


And another quick workaround if in production mode, from Settings > Design > Themes, would be to just activate any other theme for a moment (e.g. the default Casper or another one), and then back to the theme we are using. Theme modifications are effective after this as well.


For me it worked perfectly fine. I just pasted the google ad code in the code injection page and google ad started showing on my post page. After adding the google code however, I didn’t see the ads directly because of ad blocker, then I whitelisted my domain to allow ads. You can check my blog at


That’s OK for a moment to verify the ads are working. After that, it’s advisable to block them again on our browser (or in our etc/hosts file), to prevent accidentally clicking on our own ads. As it’s well-know, many publishers have lost their AdSense account that way.


Thanks for that info


The problem is that I wasn’t approved by adsense. This is the first time I play with ads and google gives you the code, but doesn’t tell you have to be approved somewhere else.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.