diff options
author | Chi Zhang <zhangch@jnist.cn> | 2021-09-09 15:15:25 +0300 |
---|---|---|
committer | Chi Zhang <zhangch@jnist.cn> | 2021-09-09 15:15:25 +0300 |
commit | 1808172f31805179406b493abdb31d36b6c1fc8b (patch) | |
tree | 961a235cf13ce501c43ab0d390641cb58d63ad1d | |
parent | b743bad139383ab0bb2d788f54b90c30d9f17454 (diff) |
:mag: baidu analytics
-rw-r--r-- | exampleSite/config.toml | 2 | ||||
-rw-r--r-- | layouts/partials/head.html | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 652efd1..28e7d3a 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -66,6 +66,8 @@ description = "This is meta description" 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 3c5b0b5..b9ed3f7 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -44,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 |