update ga to v4

This commit is contained in:
飞雪无情
2024-12-28 20:41:47 +08:00
parent 90809041cb
commit 817accd04e
5 changed files with 9 additions and 11 deletions
+3 -2
View File
@@ -178,9 +178,10 @@ type: "search"
#### 添加GA分析统计 #### 添加GA分析统计
该主题已经支持了GA分析统计,只需要在`config.toml`配置里加入如下配置即可。 该主题已经支持了GA4分析统计,只需要在`config.toml`配置里加入如下配置即可。
一定要使用最新的GA4分析,填写`衡量ID`,以`G-`开头。
```toml ```toml
googleAnalytics = "GA ID" googleAnalytics = "G-xxxxxxxxxx"
``` ```
#### 文章归档支持 #### 文章归档支持
+1 -1
View File
@@ -122,7 +122,7 @@ Ads Preview [http://www.flysnow.org/](http://www.flysnow.org/)
#### Google Analytics #### Google Analytics
```toml ```toml
googleAnalytics = "GA ID" googleAnalytics = "G-xxxxxxxxxx"
``` ```
#### Custonm Summaries #### Custonm Summaries
+1 -1
View File
@@ -1,7 +1,7 @@
{{ if and (isset .Site.Params "cc") (in (slice "post" "posts") .Type) }} {{ if and (isset .Site.Params "cc") (in (slice "post" "posts") .Type) }}
<div class="post-archive"> <div class="post-archive">
<ul class="post-copyright"> <ul class="post-copyright">
<li><strong>{{ i18n "Copyright_author" }}</strong><a rel="author" href="{{ .Site.BaseURL}}">{{ if isset .Site.Author "name" }}{{.Site.Author.name}}{{ else }}{{.Site.Title}}{{ end }}</a></li> <li><strong>{{ i18n "Copyright_author" }}</strong><a rel="author" href="{{ .Site.BaseURL}}">{{ if isset .Site.Params "Author" }}{{.Site.Params.Author}}{{ else }}{{.Site.Title}}{{ end }}</a></li>
<li style="word-break:break-all"><strong>{{ i18n "Copyright_link" }}</strong><a href="{{ .Permalink}}">{{ .Permalink}}</a></li> <li style="word-break:break-all"><strong>{{ i18n "Copyright_link" }}</strong><a href="{{ .Permalink}}">{{ .Permalink}}</a></li>
<li><strong>{{ i18n "Copyright_license" }}</strong>{{ i18n "Copyright_license_workUnder" }}<a rel="license" href="{{.Site.Params.cc.link}}">{{.Site.Params.cc.name}}</a>. {{ i18n "Copyright_license_note" }}</li> <li><strong>{{ i18n "Copyright_license" }}</strong>{{ i18n "Copyright_license_workUnder" }}<a rel="license" href="{{.Site.Params.cc.link}}">{{.Site.Params.cc.name}}</a>. {{ i18n "Copyright_license_note" }}</li>
</ul> </ul>
+3 -6
View File
@@ -1,6 +1,6 @@
<footer id="footer"> <footer id="footer">
<div> <div>
&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL | absURL }}">{{ .Site.Title }} By {{ .Site.Author.name }}</a> &copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL | absURL }}">{{ .Site.Title }} By {{ .Site.Params.Author }}</a>
{{ if .Site.Params.beian }} {{ if .Site.Params.beian }}
| <a rel="nofollow" target="_blank" href="http://beian.miit.gov.cn/">{{.Site.Params.beian}}</a> | <a rel="nofollow" target="_blank" href="http://beian.miit.gov.cn/">{{.Site.Params.beian}}</a>
{{ end }} {{ end }}
@@ -130,11 +130,8 @@
<a id="rocket" href="#top"></a> <a id="rocket" href="#top"></a>
<script type="text/javascript" src='{{ "js/totop.js?v=0.0.0" | relURL }}' async=""></script> <script type="text/javascript" src='{{ "js/totop.js?v=0.0.0" | relURL }}' async=""></script>
{{- if hasPrefix .Site.GoogleAnalytics "UA-" -}}
{{ template "_internal/google_analytics_async.html" . }} {{ template "_internal/google_analytics.html" . }}
{{- else if hasPrefix .Site.GoogleAnalytics "G-" -}}
{{ template "_internal/google_analytics.html" . }}
{{- end -}}
{{ partial "copy_button" . }} {{ partial "copy_button" . }}
+1 -1
View File
@@ -33,7 +33,7 @@
{{ if .Params.author -}} {{ if .Params.author -}}
<meta name="author" content="{{ .Params.author }}"> <meta name="author" content="{{ .Params.author }}">
{{ else }} {{ else }}
<meta name="author" content="{{ .Site.Author.name }}"> <meta name="author" content="{{ .Site.Params.Author }}">
{{- end }} {{- end }}
{{- end }} {{- end }}
<meta property="og:url" content="{{ .Permalink }}"> <meta property="og:url" content="{{ .Permalink }}">