summaryrefslogtreecommitdiffstats
path: root/layouts/partials/head.html
diff options
context:
space:
mode:
authorJiawei Huang2020-06-14 14:05:14 -0700
committerJiawei Huang2020-06-14 14:11:54 -0700
commit398ca6e2f300cce5c7bf7fa69fde42b4b592f5a4 (patch)
treeb1c500b6d8a9df942f9c1f42b31149a45fcef8df /layouts/partials/head.html
parent1a9b75fa6216334d0a9a1c379dba212888ce6f76 (diff)
downloadhugo-theme-fuji-398ca6e2f300cce5c7bf7fa69fde42b4b592f5a4.tar.gz
hugo-theme-fuji-398ca6e2f300cce5c7bf7fa69fde42b4b592f5a4.tar.bz2
hugo-theme-fuji-398ca6e2f300cce5c7bf7fa69fde42b4b592f5a4.zip
Add preliminary Google AdSense support
When `googleAdsense` is set in `config.toml`, the AdSense code snippet will be inserted between the `<head></head>` tags of your site. Only Google AdSense Auto ads is supported at the moment.
Diffstat (limited to 'layouts/partials/head.html')
-rw-r--r--layouts/partials/head.html9
1 files changed, 9 insertions, 0 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 0603c4d..b953cd8 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -41,6 +41,15 @@
<link rel="stylesheet" href="{{ "/assets/css/fuji.min.css" | relURL }}" />
{{ end }}
+{{ if .Site.Params.googleAdsense }}
+<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
+<script>
+ (adsbygoogle = window.adsbygoogle || []).push({
+ enable_page_level_ads: true,
+ google_ad_client: "ca-pub-{{.Site.Params.googleAdsense}}",
+ });
+</script>
+{{ end}}
{{ if .Params.playerURL }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css" />
{{ end }}