Hugo Google Adsense Module

Donate

Become a backer or sponsor to support our work.

Sponsors

This module offers Google AdSense support for Hugo and HugoPress.

Modulegithub.com/hugomods/google-adsense
StatsGitHub Stars Used By Used By Used By Used By

Installation

1.Import the Module

hugo.yaml

1module:
2  imports:
3  - path: github.com/hugomods/google-adsense

hugo.toml

1[module]
2  [[module.imports]]
3    path = 'github.com/hugomods/google-adsense'

hugo.json

1{
2   "module": {
3      "imports": [
4         {
5            "path": "github.com/hugomods/google-adsense"
6         }
7      ]
8   }
9}

2.Import the Partial

1<head>
2  {{ partialCached "google-adsense/index" . }}
3</head>

Site Parameters

ParameterTypeDefaultDescription
google_adsensestring-
google_adsense_ad_blocking_detectorbooleanfalseWhen true, show up an ad blocking recovery message if ad blocker was detected on your site.
google_adsense_ad_blocking_detector_fail_safebooleanfalseWhen true, show up an blocked message in the case of google_adsense_ad_blocking_detector script was blocked.

hugo.yaml

1params:
2  google_adsense: ca-pub-XXXXXXXXXXXXXXXX

hugo.toml

1[params]
2  google_adsense = 'ca-pub-XXXXXXXXXXXXXXXX'

hugo.json

1{
2   "params": {
3      "google_adsense": "ca-pub-XXXXXXXXXXXXXXXX"
4   }
5}