How to add adsense to a website managed by Bolt CMS

Written by Administrator on Thursday December 2, 2021

Bolt CMS is very simple and the same time very fast content management system. Bolt is built using twig templating language, so it means in case you want to edit pages you normally don't edit HTML-code of pages directly and can be tricky for beginners to enable Google Adsense. 

After adding your website to Google.Adsense account you will be asked to add HTML-code with your unique goole code to prove that you have full control of your website and tag it with your code:

In order to insert Google.Adsense code on our page we have to find a file named _master.twig. This is parent template for all pages of your website.

You can connect to your website using FTP or in case your hosting provider has already installed some software (online editor), you can reach the file direcly using comfortable user interface and edit files direcly on your server.

This file is stored in a folder with theme files. In my case (I'm using standard "base-2018" theme) I'm going to find it there:

Then brows to "partials":

Then locate file _master.twig for editing:

Now we see a HTML-code of a twig-template and we can insert Google.Adsense code between <head> and </head> tags:

inserting google adsense code between head tags in Bolt CMS template

Done!

Now, just save the file. No system restart is needed. Now you can view page's source in browser and see that Google.Adsense tag is present on every page of your website.