💄 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:
parent
c38a439171
commit
2a7fd9f8fb
@ -97,16 +97,3 @@
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.busuanzi-count {
|
||||
@if $busuanzi_visitors {
|
||||
#busuanzi_container_site_uv {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@if $busuanzi_views {
|
||||
#busuanzi_container_site_pv {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
.sidebar-inner {
|
||||
.sidebar-inner, .sidebar-card-widget {
|
||||
color: $grey-dark;
|
||||
// Init Sidebar & TOC inner dimensions on all pages and for all schemes.
|
||||
$offset : if(($scheme == 'Pisces') or ($scheme == 'Gemini'), $sidebar-offset, $sidebar-padding);
|
||||
@ -39,3 +39,4 @@
|
||||
@import 'sidebar-toggle';
|
||||
@import 'sidebar-toc';
|
||||
@import 'site-state';
|
||||
@import 'sidebar-card-widget';
|
||||
|
58
assets/css/_common/outline/sidebar/sidebar-card-widget.scss
Normal file
58
assets/css/_common/outline/sidebar/sidebar-card-widget.scss
Normal file
@ -0,0 +1,58 @@
|
||||
.sidebar-card-widget {
|
||||
background: var(--content-bg-color);
|
||||
border-radius: $border-radius;
|
||||
box-shadow: $box-shadow;
|
||||
box-sizing: border-box;
|
||||
color: var(--text-color);
|
||||
margin-top: $sidebar-offset;
|
||||
|
||||
.item-headline {
|
||||
text-align: left;
|
||||
font-size: $font-size-small;
|
||||
font-weight: bold;
|
||||
|
||||
span {
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.webinfo {
|
||||
font-size: $font-size-small;
|
||||
text-align: left;
|
||||
|
||||
.webinfo-item {
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
align-items: center;
|
||||
padding: 2px 10px 0;
|
||||
|
||||
i {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
text-align: center;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
|
||||
div:first-child {
|
||||
-webkit-box-flex: 1;
|
||||
-moz-box-flex: 1;
|
||||
-o-box-flex: 1;
|
||||
box-flex: 1;
|
||||
-webkit-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
padding-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.back-to-top-card {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
div:first-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
@ -34,9 +34,7 @@ $footer_vendors_enable : {{ isset $P.footer "vendors" }};
|
||||
{{ end }}
|
||||
|
||||
// Counter
|
||||
$busuanzi_visitors : {{ $P.busuanzi.visitors }};
|
||||
$busuanzi_views : {{ $P.busuanzi.views }};
|
||||
$busuanzi_post_views : {{ $P.busuanzi.postViews }};
|
||||
$busuanzi_post_views : {{ $P.analytics.busuanzi.postViews }};
|
||||
|
||||
// Font
|
||||
$font_enable : {{ $P.font.enable }};
|
||||
|
@ -10,10 +10,6 @@ js:
|
||||
- name: animejs
|
||||
version: 3.2.1
|
||||
file: lib/anime.min.js
|
||||
# TODO
|
||||
#- name: mathjax
|
||||
# version: 3.2.0
|
||||
# file: es5/tex-mml-chtml.js
|
||||
|
||||
# CSS 资源
|
||||
# CSS Resources
|
||||
@ -33,6 +29,9 @@ css:
|
||||
# Site analytics engine
|
||||
analytics:
|
||||
la: https://sdk.51.la/js-sdk-pro.min.js
|
||||
baidu: https://hm.baidu.com/hm.js?
|
||||
google: https://www.googletagmanager.com/gtag/js?id=
|
||||
busuanzi: https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js
|
||||
|
||||
# 文章分享
|
||||
# Share
|
||||
@ -95,7 +94,7 @@ plugins:
|
||||
version: 0.16.0
|
||||
file: dist/katex.min.js
|
||||
- name: auto-render
|
||||
alias: katex
|
||||
alias2: katex
|
||||
version: 0.16.0
|
||||
file: dist/contrib/auto-render.min.js
|
||||
css:
|
||||
|
@ -895,17 +895,19 @@ params:
|
||||
# 51La Analytics
|
||||
# See: https://invite.51.la/1NUfGTS1?target=V6
|
||||
laId: #<anaytics_id>
|
||||
|
||||
# TODO
|
||||
# Show Views / Visitors of the website / page with busuanzi.
|
||||
# For more information: http://ibruce.info/2015/04/04/busuanzi/
|
||||
busuanzi:
|
||||
visitors: false
|
||||
visitorsIcon: fa fa-user
|
||||
views: false
|
||||
viewsIcon: fa fa-eye
|
||||
postViews: false
|
||||
postViewsIcon: far fa-eye
|
||||
# 百度统计
|
||||
# Baidu Analytics
|
||||
#baidu: #<anaytics_id>
|
||||
# 谷歌统计
|
||||
# Google Analytics
|
||||
#google: #<anaytics_id>
|
||||
# 不蒜子统计
|
||||
# Show Views / Visitors of the website / page with busuanzi.
|
||||
# For more information: http://ibruce.info/2015/04/04/busuanzi/
|
||||
busuanzi:
|
||||
visitorsIcon: fa fa-user
|
||||
viewsIcon: fa fa-eye
|
||||
postViews: true
|
||||
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
|
@ -136,9 +136,9 @@ PostCommentTitle:
|
||||
other: 评论交流
|
||||
|
||||
VisitorsLabel:
|
||||
other: 总访客量
|
||||
other: 总访客数:
|
||||
PageViewsLabel:
|
||||
other: 总访问量
|
||||
other: 页面浏览:
|
||||
|
||||
FooterPowerby:
|
||||
other: 由 %s 强力驱动
|
||||
|
@ -17,7 +17,7 @@
|
||||
<main class="main">
|
||||
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
|
||||
<div class="header-inner">
|
||||
{{- partial "header.html" . }}
|
||||
{{- partialCached "header.html" . }}
|
||||
</div>
|
||||
<!-- Sidebar -->
|
||||
{{- if ne .Site.Params.sidebar.display "remove" }}
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user