Google Adsense and Disqus

1 minute read

Description:

This post describes how I added Google Adsense and Disqus to the Github Pages hosted website. Not sure if this is 100% legal yet, but I think so

To Resolve:

  1. Google Adsense

    • In order to add Google Adsense from my blog I need to create a custom script to insert between <head> elements

    • Since I’m currently using the remote theme Minimal Mistakes, this means adding the following file in my local instance:

    1
    2
    3
    4
    
    cd /mnt/c/_gwill/google/scripts/powershell/site/gerryw1389.github.io
    mkdir ./includes/
    mkdir ./includes/head
    touch ./includes/head/custom.html
    
    • Copy and paste the following, then save and exit:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    <!-- start custom head snippets -->
    
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({
       google_ad_client: "ca-pub-someChars",
       enable_page_level_ads: true
    });
    </script>
    
    <!-- insert favicons. use https://realfavicongenerator.net/ -->
    
    <!-- end custom head snippets -->
    
    • Then do a git commit and git push to Github as usual and wait for the build to complete.

    • Now go back to Google Adsense and look and see what it says:

    adsense

  2. Adding disqus as your commenting system is fairly straightforward, sign up for disqus, register your website, get your shortname in admin panel => site settings.

    • Then in your _config.yml
    1
    2
    3
    4
    5
    6
    7
    8
    
    site settings:
    comments:
    provider: "disqus"
    disqus:
       shortname: "automationadmin-com"
    
    # Down below, in post settings, add
    comments: true
    

Comments