If you have a Hexo based blog, and would like to add adsense ads, you could do it in two ways (auto/manual).
Adding an ad depends strongly on the blog theme you use, and can be slightly different in your theme.
- You have an adsense account
The easiest way is to add ads with “Auto ads”. It will add ad automatically based on your settings, to your page.
Adsense will identify the blog posts and will add “magically” ad to your post.
- Go to Adsense -> “Auto Ads”
- Adjust “Global” / or URL specific settings
- Click on “Setup auto ads” and copy the code snippet
To let it work, we just need to add the script we copied to the html header part of the blog.
The theme “Next“ I use, provide you a custom folder where you can add your own scripts.
The custom folder already has 3 files (head, header, sidebar). Just add the script you got, to the “head.swig” file.