Skip to content

Commit

Permalink
fix(meta_library): counter
Browse files Browse the repository at this point in the history
  • Loading branch information
inkss committed May 22, 2022
1 parent f12c639 commit 7d42316
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 83 deletions.
10 changes: 5 additions & 5 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ article:
# 文章顶部信息
# 从 meta_library 中取
top_meta: [author, category, date, counter] #启用评论数量需在此添加
# 文章底部信息
# 从 meta_library 中取
bottom_meta: [updated, tags, share]
# ----------------
# 文章页脚组件
footer_widget:
Expand Down Expand Up @@ -214,9 +217,6 @@ article:
images:
- volantis-static/media/org.volantis/blog/qrcode/[email protected] # https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/blog/qrcode/[email protected]
- volantis-static/media/org.volantis/blog/qrcode/[email protected] # https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/blog/qrcode/[email protected]
# 文章底部信息
# 从 meta_library 中取
bottom_meta: [updated, tags, share]
# meta library
meta_library:
# 默认文章作者(可在 _data/author.yaml 中增加其他作者,并在 front-matter 中设置)
Expand Down Expand Up @@ -604,8 +604,8 @@ site_footer:
source: https://github.com/volantis-x/volantis-docs/
# analytics using leancloud
analytics: >
<span id="lc-sv">本站总访问量为 <span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次</span>
<span id="lc-uv">访客数为 <span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 人</span>
<span id="lc-sv">本站总访问量为 <span id='number'><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span> 次</span>
<span id="lc-uv">访客数为 <span id='number'><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span> 人</span>
# site copyright
copyright: '[Copyright © since 2017 XXX](/)'
# You can add your own property here. (Support markdown, for example: br: '<br>')
Expand Down
110 changes: 36 additions & 74 deletions layout/_meta/counter.ejs
Original file line number Diff line number Diff line change
@@ -1,78 +1,40 @@
<% if (theme.analytics && theme.analytics.leancloud && theme.analytics.leancloud.app_id) { %>
<div class="new-meta-item browse leancloud">
<a class='notlink'>
<%
var path = post.path || page.path;
if (path.length > 9 && (path.substring(path.length - 10) == 'index.html')) {
path = path.substring(0, path.length - 10);
}
%>
<div id="lc-pv" data-title="<%- post.title || page.title %>" data-path="<%- url_for(path) %>">
<i class="<%- theme.article.body.meta_library.counter.icon %> fa-fw" aria-hidden="true"></i>
<span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span>
<%- theme.article.body.meta_library.counter.unit %>
</div>
</a>
</div>
<% } else if (theme.analytics.busuanzi) { %>
<div class="new-meta-item browse busuanzi">
<a class='notlink'>
<%
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) { %>
<div class="new-meta-item browse">
<a class='notlink'>
<p>
<i class="<%- theme.article.body.meta_library.counter.icon %> fa-fw" aria-hidden="true"></i>
<p>
<span id="busuanzi_value_page_pv">
<i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i>
</span>
<%- theme.article.body.meta_library.counter.unit %>
</p>
</a>
</div>
<% } else if (theme.comments.service=='waline' && theme.comments.waline.pageview) { %>
<div class="new-meta-item browse">
<a class='notlink'>
<i class="<%- theme.article.body.meta_library.counter.icon %> fa-fw" aria-hidden="true"></i>
<%
var path = post.path || page.path;
if (path.length > 9 && (path.substring(path.length - 10) == 'index.html')) {
path = path.substring(0, path.length - 10);
}
%>
<span data-path="<%- url_for(path) %>" class="waline-pageview-count"></span>
</a>
</div>
<% } else if (theme.comments.service=='twikoo' && !!page.comments) { %>
<div class="new-meta-item browse">
<a class='notlink'>
<i class="<%- theme.article.body.meta_library.counter.icon %> fa-fw" aria-hidden="true"></i>
<p>
<span id="twikoo_visitors">
<i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i>
</span>
</p>
<% if (theme.analytics && theme.analytics.leancloud && theme.analytics.leancloud.app_id) { %>
<span id="lc-pv" data-title="<%- post.title || page.title %>" data-path="<%- url_for(path) %>">
<span id='number'><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span>
</span>
</a>
</div>
<% } else if (theme.comments.service=='discuss' && !!page.comments) { %>
<div class="new-meta-item browse">
<a class='notlink'>
<i class="<%- theme.article.body.meta_library.counter.icon %> fa-fw" aria-hidden="true"></i>
<p>
<span id="Discuss-Visitors">
<i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i>
</span>
</p>
<% } else if (theme.analytics.busuanzi) { %>
<span id="busuanzi_value_page_pv"><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span>
<% } else if (theme.comments.service=='waline' && theme.comments.waline.pageview) { %>
<span data-path="<%- url_for(path) %>" class="waline-pageview-count">
<i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i>
</span>
<% } else if (theme.comments.service=='twikoo') { %>
<span id="twikoo_visitors">
<i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i>
</span>
<% } else if (theme.comments.service=='discuss') { %>
<span id="Discuss-Visitors">
<i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i>
</span>
<% } else if (theme.comments.service=='artalk') { %>
<span id="artalk_visitors" data-page-key="<%- url_for(path) %>">
<i class="fa-light fa-loader fa-spin fa-fw" aria-hidden="true"></i>
</span>
</a>
</div>
<% } else if (theme.comments.service=='artalk' && !!page.comments) { %>
<div class="new-meta-item browse">
<a class='notlink'>
<i class="<%- theme.article.body.meta_library.counter.icon %> fa-fw" aria-hidden="true"></i>
<p>
<span id="artalk_visitors">
<i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i>
</span>
<%- theme.article.body.meta_library.counter.unit %>
</p>
</a>
</div>
<% } %>
<span><%- theme.article.body.meta_library.counter.unit %></span>
</p>
</a>
</div>
<% } %>
2 changes: 1 addition & 1 deletion layout/_partial/footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<%- __('footer.use') %>
<a href="https://github.com/volantis-x/hexo-theme-volantis/tree/<%- theme_version %>" target="_blank" class="codename">Volantis</a>
<%- __('footer.theme') %><% if (theme.analytics.busuanzi) { %><%- __('symbol.comma') %><%- __('footer.total_views') %>
<span id="busuanzi_value_site_pv"><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span>
<span id="busuanzi_value_site_pv"><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span>
<%- __('footer.times') %>
<% } %>
<% } else if (item == 'source') { %>
Expand Down
4 changes: 2 additions & 2 deletions layout/_widget/webinfo.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<% if (!!theme.analytics.busuanz) {%>
<div><span id="busuanzi_value_site_uv"><i class="fa-solid fa-fan fa-spin fa-fw" aria-hidden="true"></i></span> <%= item.type.visitcounter.siteuv.unit %></div>
<% } else { %>
<div><span id="lc-uv"><span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span></span> <%= item.type.visitcounter.siteuv.unit %></div>
<div><span id="lc-uv"><span id='number'><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span></span> <%= item.type.visitcounter.siteuv.unit %></div>
<% } %>
</div>
<% } %>
Expand All @@ -42,7 +42,7 @@
<% if (!!theme.analytics.busuanz) {%>
<div><span id="busuanzi_value_site_pv"><i class="fa-solid fa-fan fa-spin fa-fw" aria-hidden="true"></i></span> <%= item.type.visitcounter.sitepv.unit %></div>
<% } else { %>
<div><span id="lc-sv"><span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span></span> <%= item.type.visitcounter.sitepv.unit %></div>
<div><span id="lc-sv"><span id='number'><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span></span> <%= item.type.visitcounter.sitepv.unit %></div>
<% } %>
</div>
<% } %>
Expand Down
2 changes: 1 addition & 1 deletion source/css/_style/_layout/main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
&:last-child
margin-right: 0
img,i
display: inline
display: inline-block
i
margin-right: 4px
border-radius: 0
Expand Down

0 comments on commit 7d42316

Please sign in to comment.