Skip to content

Commit 7e57bbf

Browse files
committed
Merge pull request #809 from panzhitian/master
add busuanzi counter with customization
2 parents 506649a + fb18210 commit 7e57bbf

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

_config.yml

+17
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,23 @@ leancloud_visitors:
288288
app_id: #<app_id>
289289
app_key: #<app_key>
290290

291+
# Show PV/UV of the website/page with busuanzi.
292+
# Get more information on http://ibruce.info/2015/04/04/busuanzi/
293+
busuanzi_count:
294+
# count values only if the other configs are false
295+
enable: false
296+
# custom uv span for the whole site
297+
site_uv: true
298+
site_uv_header: <i class="fa fa-user"></i>
299+
site_uv_footer:
300+
# custom pv span for the whole site
301+
site_pv: true
302+
site_pv_header: <i class="fa fa-eye"></i>
303+
site_pv_footer:
304+
# custom pv span for one page only
305+
page_pv: true
306+
page_pv_header: <i class="fa fa-file-o"></i>
307+
page_pv_footer:
291308

292309
# Tencent analytics ID
293310
# tencent_analytics:

layout/_macro/post.swig

+6
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@
115115
</span>
116116
{% endif %}
117117

118+
{% if not is_index and theme.busuanzi_count.enable and theme.busuanzi_count.page_pv %}
119+
&nbsp; | &nbsp;
120+
<span class="page-pv">{{ theme.busuanzi_count.page_pv_header }}
121+
<span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>{{ theme.busuanzi_count.page_pv_footer }}
122+
</span>
123+
{% endif %}
118124
</div>
119125
</header>
120126
{% endif %}

layout/_partials/footer.swig

+12
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,16 @@
1919
</a>
2020
</div>
2121

22+
{% if theme.busuanzi_count.enable %}
23+
<div class="busuanzi-count">
24+
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
25+
{% if theme.busuanzi_count.site_uv %}
26+
<span class="site-uv">{{ theme.busuanzi_count.site_uv_header }}<span class="busuanzi-value" id="busuanzi_value_site_uv"></span>{{ theme.busuanzi_count.site_uv_footer }}</span>
27+
{% endif %}
28+
{% if theme.busuanzi_count.site_pv %}
29+
<span class="site-pv">{{ theme.busuanzi_count.site_pv_header }}<span class="busuanzi-value" id="busuanzi_value_site_pv"></span>{{ theme.busuanzi_count.site_pv_footer }}</span>
30+
{% endif %}
31+
</div>
32+
{% endif %}
33+
2234
{% block footer %}{% endblock %}

source/css/_common/components/footer/footer.styl

+30
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,36 @@
2424
}
2525
}
2626

27+
.busuanzi-count {
28+
&:before {
29+
content: " ";
30+
float: left;
31+
width: 260px;
32+
min-height: 25px;
33+
}
34+
}
35+
36+
.site-uv,
37+
.site-pv,
38+
.page-pv {
39+
display: inline-block;
40+
41+
.busuanzi-value {
42+
margin: 0 5px;
43+
}
44+
}
45+
46+
if hexo-config("busuanzi_count.site_pv") and hexo-config("busuanzi_count.site_uv")
47+
.site-uv
48+
{
49+
margin-right: 10px;
50+
51+
&::after {
52+
content: "|";
53+
padding-left: 10px;
54+
}
55+
}
56+
2757
.cc-license {
2858
margin-top: 10px;
2959
text-align: center;

0 commit comments

Comments
 (0)