To add Google AdSense in your DokuWiki in a easy way, you need to first install the DokuWiki Bootstrap3 Template, and then adding HTML Hooks with your AdSense codes.
Bootstrap3 Template can be easily install in the DokuWiki Admin page.
Admin Page
Extension Manager
Search and Install
tabbootstrap template
Install
button.Now you need to activate the newly installed Bootstrap3 Template
Admin Page
Configuration Manager
Save
button to save.Now you need to go to your AdSense account, and create a new ads unit. After creating the ads unit, copy the Ad code. It should be something look like:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- your.ads.name --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-xxxxxxxxxxxxxxx" data-ad-slot="xxxxxxxxxxx" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
Now that everything is ready, let's add our ads to DukoWiki.
cd /var/www/dokuwiku
for example.cd ./lib/tpl/bootstrap3
. This is the boostrap3 template directory.header.html
. This is one of the html hook we can add for the boostrap3 template. You can use vim or nano, or the any text editor you like to do so. Note that you need to use sudo
here.user@server:/var/www/dokuwiki/lib/tpl/bootstrap3$ sudo vim header.html
footer.html
, topheader.html
, … The html hooks details can be found here https://www.dokuwiki.org/template:bootstrap3:hooks.