diff options
author | Mehedi Sharif Titas <mehedishariftitas@gmail.com> | 2021-09-09 19:03:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-09 19:03:29 +0300 |
commit | 4cb7e73fe28f806f3394952dee12cb8047c93d81 (patch) | |
tree | 961a235cf13ce501c43ab0d390641cb58d63ad1d | |
parent | 17ab9b707cdd76aea360dca43ac39997b8ac5272 (diff) | |
parent | 1808172f31805179406b493abdb31d36b6c1fc8b (diff) |
Merge pull request #45 from realZhangChi/master
Add Baidu analytics support
-rw-r--r-- | exampleSite/config.toml | 4 | ||||
-rw-r--r-- | layouts/partials/head.html | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1d32c59..28e7d3a 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -64,6 +64,10 @@ author = "Johnathan Smith" description = "This is meta description" # google analytics google_analytics_id = "" # Your ID +# baidu site verification +baidu_site_verification = "" Your verification code +# baidu analytics +baidu_analytics_id = "" Your ID # copyright copyright = "Copyright © 2021 a Theme by [Gethugothemes](https://gethugothemes.com)" diff --git a/layouts/partials/head.html b/layouts/partials/head.html index c1e937c..b9ed3f7 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -8,6 +8,11 @@ {{ with site.Params.author }}<meta name="author" content="{{ . }}">{{ end }} {{ hugo.Generator }} + {{ with site.Params.baidu_site_verification }} + {{ "<!-- baidu site verification -->" | safeHTML }} + <meta name="baidu-site-verification" content="{{ . }}" /> + {{ end }} + <style> :root{ --primary-color:{{ site.Params.theme_color }}; @@ -39,4 +44,17 @@ </script> {{ end }} + {{ with site.Params.baidu_analytics_id }} + {{ "<!-- Baidu analytics -->" | safeHTML }} + <script> + var _hmt = _hmt || []; + (function() { + var hm = document.createElement("script"); + hm.src = "https://hm.baidu.com/hm.js?{{ . }}"; + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(hm, s); + })(); + </script> + {{ end }} + </head>
\ No newline at end of file |