Skip to content

Commit 5917d6f

Browse files
author
linjianyou
committed
谷歌的分析代码放在head_custome里,和SEO优化search console验证
1 parent ecb8ed3 commit 5917d6f

File tree

5 files changed

+60
-2
lines changed

5 files changed

+60
-2
lines changed

googlee10be6f671ab780a.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-site-verification: googlee10be6f671ab780a.html

layouts/partials/footer_custom.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!--
2+
If you want to include any custom html just before </body>, put it in this file.
3+
Or you can delete these file if you don't need it.
4+
-->
5+
<!-- for example, you could include some js libraries:
6+
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.19.1/vis.js" integrity="sha256-HdIuWBZj4eftihsoDCJoMYjZi6aNVaw7YlUpzKT3ZxI=" crossorigin="anonymous"></script>
7+
-->

layouts/partials/head_custom.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!--
2+
If you want to include any custom html just before </head>, put it in this file.
3+
Or you can delete these file if you don't need it.
4+
-->
5+
<!-- for example, you could insert this custom css, which makes the bigimg not stretch:
6+
<style>
7+
.intro-header.big-img, .intro-header.big-img .big-img-transition {
8+
-webkit-background-size: contain !important;
9+
-moz-background-size: contain !important;
10+
background-size: contain !important;
11+
-o-background-size: contain !important;
12+
background-color: lightgrey;
13+
}
14+
</style>
15+
-->
16+
<!-- or you could include some additional css libraries:
17+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.19.1/vis.css" integrity="sha256-I1UoFd33KHIydu88R9owFaQWzwkiZV4hXXug5aYaM28=" crossorigin="anonymous" />
18+
-->
19+
<script type="text/javascript" src="http://cbjs.baidu.com/js/m.js"></script>
20+
<script>
21+
var _hmt = _hmt || [];
22+
(function () {
23+
var hm = document.createElement("script");
24+
hm.src = "//hm.baidu.com/hm.js?ac918c8b5f9b985db0771865dedc902e";
25+
var s = document.getElementsByTagName("script")[0];
26+
s.parentNode.insertBefore(hm, s);
27+
})();
28+
</script>
29+
<meta name="baidu-site-verification" content="LVGuWnlLCo"/>
30+
<meta name="google-adsense-account" content="ca-pub-5363852791482518">
31+
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5363852791482518" crossorigin="anonymous"></script>
32+
{{/* 把谷歌的分析代码放在head头部 */}}
33+
{{- $analytics := .Site.Params.analytics -}}
34+
{{- $enable := .Site.Params.analytics.enable -}}
35+
{{- $id := .Site.Params.analytics.google.id -}}
36+
{{warnf "analytics.enable %s" $id}}
37+
{{- if $enable -}}
38+
{{- /* Google Analytics */ -}}
39+
{{- with $id -}}
40+
<script>
41+
window.dataLayer=window.dataLayer||[];
42+
function gtag(){
43+
dataLayer.push(arguments);
44+
}
45+
gtag('js', new Date());
46+
gtag('config', '{{ . }}'{{ if $analytics.google.anonymizeIP }}, { 'anonymize_ip': true }{{ end }});
47+
</script>
48+
{{ printf "https://www.googletagmanager.com/gtag/js?id=%v" . | dict "Async" true "Source" | partial "plugin/script.html" }}
49+
{{- end -}}
50+
{{- end -}}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "github 主站点",
55
"main": "index.html",
66
"scripts": {
7-
"test": "rm -rf public && hugo serve --gc --minify",
7+
"test": "rm -rf public && hugo serve #--gc --minify",
88
"pro": "HUGO_ENVIRONMENT=production hugo server --gc --minify"
99
},
1010
"repository": {

0 commit comments

Comments
 (0)