💄 Support more of analytics engine such as baidu, google, busuanzi and so on, then add new web information widget. close #19
This commit is contained in:
@@ -3,14 +3,19 @@
|
||||
{{ $fmt := "%s/%s@%s/%s" }}
|
||||
|
||||
{{ $npm := .res.name }}
|
||||
{{ with .res.alias }}
|
||||
{{ with .res.alias2 }}
|
||||
{{ $npm = . }}
|
||||
{{ end }}
|
||||
{{ $file := .res.file }}
|
||||
{{ if eq .vendor "cdnjs" }}
|
||||
{{ $file = replaceRE `(dist|lib|source\/js)\/` "" .res.file }}
|
||||
{{ $fmt = "%s/%s/%s/%s" }}
|
||||
{{ end }}
|
||||
{{- $file := .res.file }}
|
||||
|
||||
{{- if eq .vendor "cdnjs" }}
|
||||
{{- with .res.alias }}
|
||||
{{- $npm = . }}
|
||||
{{- end }}
|
||||
{{- $file = replaceRE `(dist|lib|source\/js)\/` "" .res.file }}
|
||||
{{- $fmt = "%s/%s/%s/%s" }}
|
||||
{{- end }}
|
||||
|
||||
{{ $pluginRes := printf $fmt .router $npm .res.version $file }}
|
||||
|
||||
{{ return $pluginRes }}
|
||||
@@ -12,6 +12,6 @@
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
</script>
|
||||
|
||||
11
layouts/partials/_thirdparty/analytics/baidu.html
vendored
Normal file
11
layouts/partials/_thirdparty/analytics/baidu.html
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
var script = document.createElement('script');
|
||||
|
||||
script.charset = "UTF-8";
|
||||
script.src = "{{ .Site.Data.resources.analytics.baidu }}{{ .Site.Params.analytics.baidu }}";
|
||||
script.async = "true"
|
||||
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
</script>
|
||||
11
layouts/partials/_thirdparty/analytics/busuanzi.html
vendored
Normal file
11
layouts/partials/_thirdparty/analytics/busuanzi.html
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
var script = document.createElement('script');
|
||||
|
||||
script.charset = "UTF-8";
|
||||
script.src = "{{ .Site.Data.resources.analytics.busuanzi }}";
|
||||
script.async = "true"
|
||||
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
</script>
|
||||
18
layouts/partials/_thirdparty/analytics/google.html
vendored
Normal file
18
layouts/partials/_thirdparty/analytics/google.html
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
var script = document.createElement('script');
|
||||
|
||||
script.charset = "UTF-8";
|
||||
script.src = "{{ .Site.Data.resources.analytics.google }}{{ .Site.Params.analytics.google }}";
|
||||
script.async = "true"
|
||||
script.onload = function() {
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ .Site.Params.analytics.google }} ');
|
||||
}
|
||||
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
</script>
|
||||
@@ -3,7 +3,7 @@
|
||||
{{- partial "head/twitter.html" . }}
|
||||
{{- partial "head/googleplus.html" . }}
|
||||
{{- partial "head/facebook.html" . }}
|
||||
{{- partial "head/verify.html" . }}
|
||||
{{- partialCached "head/verify.html" . }}
|
||||
{{- partialCached "head/style.html" . }}
|
||||
{{- partial "head/config.html" . }}
|
||||
{{- partialCached "head/analytics.html" . }}
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
{{- if isset .Site.Params.analytics "laid" }}
|
||||
{{ partial "_thirdparty/analytics/51la.html" . }}
|
||||
{{- end }}
|
||||
{{- if isset .Site.Params.analytics "baidu" }}
|
||||
{{ partial "_thirdparty/analytics/baidu.html" . }}
|
||||
{{- end }}
|
||||
{{- if isset .Site.Params.analytics "google" }}
|
||||
{{ partial "_thirdparty/analytics/google.html" . }}
|
||||
{{- end }}
|
||||
{{- if isset .Site.Params.analytics "busuanzi" }}
|
||||
{{ partial "_thirdparty/analytics/busuanzi.html" . }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css">
|
||||
<!-- NexT theme css style -->
|
||||
{{- $scssVars := resources.Get "css/_sitevars.scss"}}
|
||||
{{- $scssVars = $scssVars | resources.ExecuteAsTemplate "sitevars.scss" . }}
|
||||
{{- $scssMain := resources.Get "css/main.scss" }}
|
||||
{{- $scss := slice $scssVars $scssMain | resources.Concat "css/main.scss" }}
|
||||
{{- $css := $scss | toCSS (dict "targetPath" "/css/main_new.css" "outputStyle" "expanded") }}
|
||||
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
|
||||
{{- $scheme := lower .Site.Params.scheme }}
|
||||
{{- $styleScheme := (printf "css/%s/style.css" $scheme) }}
|
||||
<link rel="stylesheet" href="/css/{{ $scheme }}/main.css">
|
||||
{{- $style := resources.Get $styleScheme | resources.ExecuteAsTemplate $styleScheme . }}
|
||||
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
|
||||
<link rel="stylesheet" href="/css/hover.css">
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,19 +2,10 @@
|
||||
{{- $cssRes := .Site.Data.resources.css }}
|
||||
{{- $vendor := .Site.Params.vendors.plugins }}
|
||||
{{- $router := .Scratch.Get "router" }}
|
||||
{{ $cssFmt := "%s/%s@%s/%s" }}
|
||||
|
||||
{{- range $css := $cssRes }}
|
||||
{{- $npm := $css.name }}
|
||||
{{- $file := $css.file }}
|
||||
{{- if eq $vendor "cdnjs" }}
|
||||
{{- with $css.alias }}
|
||||
{{- $npm = . }}
|
||||
{{- end }}
|
||||
{{- $file = replaceRE `(dist|lib|source\/js)\/` "" $css.file }}
|
||||
{{- $cssFmt = "%s/%s/%s/%s" }}
|
||||
{{- end }}
|
||||
{{- $pluginCSS := printf $cssFmt $router $npm $css.version $file }}
|
||||
<link type="text/css" rel="stylesheet" href="{{ $pluginCSS }}" />
|
||||
{{ $pluginCss := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
|
||||
<link type="text/css" rel="stylesheet" href="{{ $pluginCss }}" />
|
||||
{{- end }}
|
||||
|
||||
<!-- Main Style file -->
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{{- $pageViewCls := "" }}
|
||||
{{- $pageViewId := "" }}
|
||||
{{- if .Site.Params.leancloudVisitors.enable }}
|
||||
{{- $pageViewCls = "leancloud-visitors-count" }}
|
||||
{{- $pageViewId = "leancloud-visitors-count" }}
|
||||
{{- end }}
|
||||
{{- if .Site.Params.waline.pageView }}
|
||||
{{- $pageViewCls = "waline-pageview-count" }}
|
||||
{{- $pageViewId = "waline-pageview-count" }}
|
||||
{{- end }}
|
||||
{{- if .Site.Params.busuanzi.postViews }}
|
||||
{{- $pageViewCls = "busuanzi_value_page_pv" }}
|
||||
{{- if .Site.Params.analytics.busuanzi.postViews }}
|
||||
{{- $pageViewId = "busuanzi_value_page_pv" }}
|
||||
{{- end }}
|
||||
<span class="post-meta-item" title="{{ T "PostViews" }}">
|
||||
<span class="post-meta-item-icon">
|
||||
@@ -15,5 +15,5 @@
|
||||
<span class="post-meta-item-text">
|
||||
{{ print (T "PostViews") (T "SymbolColon") }}
|
||||
</span>
|
||||
<span class="{{ $pageViewCls }}" data-path="{{ .RelPermalink | relLangURL }}"><i class="fa fa-sync fa-spin"></i></span>
|
||||
<span id="{{ $pageViewId }}" data-path="{{ .RelPermalink | relLangURL }}"><i class="fa fa-sync fa-spin"></i></span>
|
||||
</span>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{{ if $cssRes }}
|
||||
{{ range $cssRes }}
|
||||
{{ $css := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
|
||||
<link rel="stylesheet" href="{{ $css }}"/>
|
||||
<link type="text/css" rel="stylesheet" href="{{ $css }}"/>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- $jsRes := $res.js }}
|
||||
|
||||
@@ -31,12 +31,18 @@
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{- if and .Site.Params.backTop.enable .Site.Params.backTop.sidebar }}
|
||||
|
||||
</div>
|
||||
|
||||
{{ partial "sidebar/webinfo.html" . }}
|
||||
|
||||
{{- if and .Site.Params.backTop.enable .Site.Params.backTop.sidebar }}
|
||||
<div class="sidebar-card-widget back-to-top-card">
|
||||
<div class="back-to-top animated" role="button" aria-label="{{ T "BackTop" }}">
|
||||
<i class="fa fa-arrow-up"></i>
|
||||
<span>0%</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
</aside>
|
||||
<div class="sidebar-dimmer"></div>
|
||||
<div class="sidebar-dimmer"></div>
|
||||
|
||||
34
layouts/partials/sidebar/webinfo.html
Normal file
34
layouts/partials/sidebar/webinfo.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="sidebar-card-widget">
|
||||
<div class="item-headline">
|
||||
<i class="fas fa-chart-line"></i>
|
||||
<span>网站资讯</span>
|
||||
</div>
|
||||
<div class="webinfo">
|
||||
<!-- <div class="webinfo-item">
|
||||
<div class="item-name">已运行时间 :</div>
|
||||
<div class="item-count" id="runtimeshow" data-publishdate="2021-07-28T14:00:00.000Z">409 天</div>
|
||||
</div>
|
||||
<div class="webinfo-item">
|
||||
<div class="item-name">本站总字数 :</div>
|
||||
<div class="item-count">21.4k</div>
|
||||
</div> -->
|
||||
{{ with .Site.Params.analytics.busuanzi }}
|
||||
<div class="webinfo-item">
|
||||
<div class="item-name">
|
||||
<i class="fas {{ .visitorsIcon }}"></i>{{ T "VisitorsLabel" }}
|
||||
</div>
|
||||
<div class="item-count" id="busuanzi_value_site_uv"></div>
|
||||
</div>
|
||||
<div class="webinfo-item">
|
||||
<div class="item-name">
|
||||
<i class="fas {{ .viewsIcon }}"></i>{{ T "PageViewsLabel" }}
|
||||
</div>
|
||||
<div class="item-count" id="busuanzi_value_site_pv"></div>
|
||||
</div>
|
||||
{{ end }}
|
||||
<!-- <div class="webinfo-item">
|
||||
<div class="item-name">最后更新时间 :</div>
|
||||
<div class="item-count" id="last-push-date" data-lastpushdate="2022-05-13T03:49:57.728Z">4 个月前</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user