====== Adding Google AdSense in DukoWiki ====== 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. ===== Install Bootstrap3 Template ===== Bootstrap3 Template can be easily install in the DokuWiki Admin page. - Go to ''Admin Page'' - Select ''Extension Manager'' - Select ''Search and Install'' tab - Search with keyword ''bootstrap template'' - Next to Bootstrap3 Template, click the ''Install'' button. ===== Activate Bootstrap3 Template ===== Now you need to activate the newly installed Bootstrap3 Template - Go to ''Admin Page'' - Select ''Configuration Manager'' - Under ''basic'' section, change the template to ''bootstrap3''{{ :adding_google_adsense_1.png?direct&200 |}} - Go to the end of the page, click ''Save'' button to save. ===== Adding the Google AdSense Ads ===== 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: Now that everything is ready, let's add our ads to DukoWiki. - Open a terminal on your server, or ssh to it. - Change to the DokuWiki directory you installed it. ''cd /var/www/dokuwiku'' for example. - Go to directory ./lib/tpl/bootstrap3 ''cd ./lib/tpl/bootstrap3''. This is the boostrap3 template directory. - Create a file called ''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 - Inside this header.html file, paste the Google Ad code you obtain from the Adsense site. - Save the file. - Now go to your DokuWiki page, and you should see your ads in the page header.{{ :adding_google_adsense_2.png?direct&350 |}} - You might add the ads in other places like ''footer.html'', ''topheader.html'', ... The html hooks details can be found here [[https://www.dokuwiki.org/template:bootstrap3:hooks]].