diff --git a/assets/css/_common/outline/footer/index.scss b/assets/css/_common/outline/footer/index.scss index 4bfdcd2..b6cdcbe 100644 --- a/assets/css/_common/outline/footer/index.scss +++ b/assets/css/_common/outline/footer/index.scss @@ -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; - } - } -} diff --git a/assets/css/_common/outline/sidebar/index.scss b/assets/css/_common/outline/sidebar/index.scss index 0fe80e5..da01454 100644 --- a/assets/css/_common/outline/sidebar/index.scss +++ b/assets/css/_common/outline/sidebar/index.scss @@ -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'; diff --git a/assets/css/_common/outline/sidebar/sidebar-card-widget.scss b/assets/css/_common/outline/sidebar/sidebar-card-widget.scss new file mode 100644 index 0000000..b989cc3 --- /dev/null +++ b/assets/css/_common/outline/sidebar/sidebar-card-widget.scss @@ -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; + } +} \ No newline at end of file diff --git a/assets/css/main.scss b/assets/css/main.scss index cfc0739..61cf805 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -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 }}; diff --git a/data/resources.yaml b/data/resources.yaml index 97c26fe..5d57b65 100644 --- a/data/resources.yaml +++ b/data/resources.yaml @@ -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: diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 64fb5d0..9a0bed7 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -895,17 +895,19 @@ params: # 51La Analytics # See: https://invite.51.la/1NUfGTS1?target=V6 laId: # - - # 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: # + # 谷歌统计 + # Google Analytics + #google: # + # 不蒜子统计 + # 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 # --------------------------------------------------------------- diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index a0b30be..b72ee34 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -136,9 +136,9 @@ PostCommentTitle: other: 评论交流 VisitorsLabel: - other: 总访客量 + other: 总访客数: PageViewsLabel: - other: 总访问量 + other: 页面浏览: FooterPowerby: other: 由 %s 强力驱动 diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 7606f8a..bb357db 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -17,7 +17,7 @@
- {{- partial "header.html" . }} + {{- partialCached "header.html" . }}
{{- if ne .Site.Params.sidebar.display "remove" }} diff --git a/layouts/partials/_funs/get_res.html b/layouts/partials/_funs/get_res.html index 6aa8a7f..c49a386 100644 --- a/layouts/partials/_funs/get_res.html +++ b/layouts/partials/_funs/get_res.html @@ -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 }} \ No newline at end of file diff --git a/layouts/partials/_thirdparty/analytics/51la.html b/layouts/partials/_thirdparty/analytics/51la.html index 07e9221..63d0886 100644 --- a/layouts/partials/_thirdparty/analytics/51la.html +++ b/layouts/partials/_thirdparty/analytics/51la.html @@ -12,6 +12,6 @@ {{ end }} } - document.head.appendChild(script); -}); + document.head.appendChild(script); + }); diff --git a/layouts/partials/_thirdparty/analytics/baidu.html b/layouts/partials/_thirdparty/analytics/baidu.html new file mode 100644 index 0000000..7795e0c --- /dev/null +++ b/layouts/partials/_thirdparty/analytics/baidu.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/layouts/partials/_thirdparty/analytics/busuanzi.html b/layouts/partials/_thirdparty/analytics/busuanzi.html new file mode 100644 index 0000000..2bdda46 --- /dev/null +++ b/layouts/partials/_thirdparty/analytics/busuanzi.html @@ -0,0 +1,11 @@ + diff --git a/layouts/partials/_thirdparty/analytics/google.html b/layouts/partials/_thirdparty/analytics/google.html new file mode 100644 index 0000000..103dd4c --- /dev/null +++ b/layouts/partials/_thirdparty/analytics/google.html @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index aac885c..f9f3662 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -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" . }} diff --git a/layouts/partials/head/analytics.html b/layouts/partials/head/analytics.html index 37a5b2f..63301bb 100644 --- a/layouts/partials/head/analytics.html +++ b/layouts/partials/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 }} diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html deleted file mode 100644 index d9e8298..0000000 --- a/layouts/partials/head/css.html +++ /dev/null @@ -1,19 +0,0 @@ - - - -{{- $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") }} - -{{- $scheme := lower .Site.Params.scheme }} -{{- $styleScheme := (printf "css/%s/style.css" $scheme) }} - -{{- $style := resources.Get $styleScheme | resources.ExecuteAsTemplate $styleScheme . }} - - - - - - diff --git a/layouts/partials/head/style.html b/layouts/partials/head/style.html index 69bea95..c91bd20 100644 --- a/layouts/partials/head/style.html +++ b/layouts/partials/head/style.html @@ -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 }} - + {{ $pluginCss := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }} + {{- end }} diff --git a/layouts/partials/post/header_meta/views.html b/layouts/partials/post/header_meta/views.html index 21dfbb1..303d74c 100644 --- a/layouts/partials/post/header_meta/views.html +++ b/layouts/partials/post/header_meta/views.html @@ -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 }}