diff options
author | Asur <asur@asurbernardo.com> | 2020-07-25 23:21:42 +0300 |
---|---|---|
committer | Asur <asur@asurbernardo.com> | 2020-07-25 23:21:42 +0300 |
commit | 68af642cb45a2be0cacddb9757011157e9ae3c88 (patch) | |
tree | 552d9cb85e2e0880974436468e72cb72e8a3273f | |
parent | 81de332aebd3e47e65075086f7375e1e686d37c6 (diff) |
Move auto-ads script to its own partial and add configuration capabilities
-rw-r--r-- | data/auto-ads-config.json | 15 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 2 | ||||
-rw-r--r-- | layouts/partials/page/auto-ads.html | 6 |
3 files changed, 21 insertions, 2 deletions
diff --git a/data/auto-ads-config.json b/data/auto-ads-config.json new file mode 100644 index 0000000..e966b2a --- /dev/null +++ b/data/auto-ads-config.json @@ -0,0 +1,15 @@ +{ + "placements": [ + { + "anchor": { + "selector": "ARTICLE.content", + "sub": { + "selector": "P", + "all": true + } + }, + "pos": 4, + "type": 1 + } + ] +}
\ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index ea81f18..800f5b6 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,7 +4,7 @@ {{- partial "head/base.html" . -}} </head> <body> - {{- partial "page/auto-ads.html" -}} + {{- partial "page/auto-ads.html" . -}} {{- partial "page/install-sw.html" . -}} {{- partial "page/analytics.html" . -}} {{- partial "structured-data/base.html" . -}} diff --git a/layouts/partials/page/auto-ads.html b/layouts/partials/page/auto-ads.html index 5fe26a8..dbc575f 100644 --- a/layouts/partials/page/auto-ads.html +++ b/layouts/partials/page/auto-ads.html @@ -1,5 +1,9 @@ {{ with .Site.Params.AdsensePublisher }} {{ if eq $.Site.Params.AutoAdsEnabled true }} - <amp-auto-ads type="adsense" data-ad-client="{{ . }}"></amp-auto-ads> + <amp-auto-ads type="adsense" data-ad-client="{{ . }}"> + <script type="application/json"> + {{ index $.Site.Data "auto-ads-config" }} + </script> + </amp-auto-ads> {{ end }} {{ end }}
\ No newline at end of file |