From 7d42316a80909125938774b9685b4962486ecc65 Mon Sep 17 00:00:00 2001 From: inkss Date: Sun, 22 May 2022 12:49:26 +0800 Subject: [PATCH] fix(meta_library): counter --- _config.yml | 10 +-- layout/_meta/counter.ejs | 110 +++++++++------------------- layout/_partial/footer.ejs | 2 +- layout/_widget/webinfo.ejs | 4 +- source/css/_style/_layout/main.styl | 2 +- 5 files changed, 45 insertions(+), 83 deletions(-) diff --git a/_config.yml b/_config.yml index 0528568d1..9277c928b 100755 --- a/_config.yml +++ b/_config.yml @@ -176,6 +176,9 @@ article: # 文章顶部信息 # 从 meta_library 中取 top_meta: [author, category, date, counter] #启用评论数量需在此添加 + # 文章底部信息 + # 从 meta_library 中取 + bottom_meta: [updated, tags, share] # ---------------- # 文章页脚组件 footer_widget: @@ -214,9 +217,6 @@ article: images: - volantis-static/media/org.volantis/blog/qrcode/github@volantis.png # https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/blog/qrcode/github@volantis.png - volantis-static/media/org.volantis/blog/qrcode/github@volantis.png # https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/blog/qrcode/github@volantis.png - # 文章底部信息 - # 从 meta_library 中取 - bottom_meta: [updated, tags, share] # meta library meta_library: # 默认文章作者(可在 _data/author.yaml 中增加其他作者,并在 front-matter 中设置) @@ -604,8 +604,8 @@ site_footer: source: https://github.com/volantis-x/volantis-docs/ # analytics using leancloud analytics: > - 本站总访问量为 - 访客数为 + 本站总访问量为 + 访客数为 # site copyright copyright: '[Copyright © since 2017 XXX](/)' # You can add your own property here. (Support markdown, for example: br: '
') diff --git a/layout/_meta/counter.ejs b/layout/_meta/counter.ejs index 0a997c6be..825369245 100644 --- a/layout/_meta/counter.ejs +++ b/layout/_meta/counter.ejs @@ -1,78 +1,40 @@ -<% if (theme.analytics && theme.analytics.leancloud && theme.analytics.leancloud.app_id) { %> -
- - <% - var path = post.path || page.path; - if (path.length > 9 && (path.substring(path.length - 10) == 'index.html')) { - path = path.substring(0, path.length - 10); - } - %> -
- - - <%- theme.article.body.meta_library.counter.unit %> -
-
-
-<% } else if (theme.analytics.busuanzi) { %> -
- +<% + let path = post.path || page.path; + if (path.length > 9 && (path.substring(path.length - 10) == 'index.html')) { + path = path.substring(0, path.length - 10); + } +%> + +<% if (!!page.comments) { %> + -<% } else if (theme.comments.service=='waline' && theme.comments.waline.pageview) { %> - -<% } else if (theme.comments.service=='twikoo' && !!page.comments) { %> - -<% } else if (theme.comments.service=='discuss' && !!page.comments) { %> - -<% } else if (theme.comments.service=='artalk' && !!page.comments) { %> - + <% } %> + <%- theme.article.body.meta_library.counter.unit %> +

+ +
<% } %> diff --git a/layout/_partial/footer.ejs b/layout/_partial/footer.ejs index c9baf73d9..74b629ff4 100755 --- a/layout/_partial/footer.ejs +++ b/layout/_partial/footer.ejs @@ -41,7 +41,7 @@ <%- __('footer.use') %> Volantis <%- __('footer.theme') %><% if (theme.analytics.busuanzi) { %><%- __('symbol.comma') %><%- __('footer.total_views') %> - + <%- __('footer.times') %> <% } %> <% } else if (item == 'source') { %> diff --git a/layout/_widget/webinfo.ejs b/layout/_widget/webinfo.ejs index 34778a785..6edbb16b0 100644 --- a/layout/_widget/webinfo.ejs +++ b/layout/_widget/webinfo.ejs @@ -31,7 +31,7 @@ <% if (!!theme.analytics.busuanz) {%>
<%= item.type.visitcounter.siteuv.unit %>
<% } else { %> -
<%= item.type.visitcounter.siteuv.unit %>
+
<%= item.type.visitcounter.siteuv.unit %>
<% } %> <% } %> @@ -42,7 +42,7 @@ <% if (!!theme.analytics.busuanz) {%>
<%= item.type.visitcounter.sitepv.unit %>
<% } else { %> -
<%= item.type.visitcounter.sitepv.unit %>
+
<%= item.type.visitcounter.sitepv.unit %>
<% } %> <% } %> diff --git a/source/css/_style/_layout/main.styl b/source/css/_style/_layout/main.styl index 82b5fe022..7f88c1bc0 100644 --- a/source/css/_style/_layout/main.styl +++ b/source/css/_style/_layout/main.styl @@ -185,7 +185,7 @@ &:last-child margin-right: 0 img,i - display: inline + display: inline-block i margin-right: 4px border-radius: 0