Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add busuanzi counter with customization #809

Merged
merged 2 commits into from
Apr 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,23 @@ leancloud_visitors:
app_id: #<app_id>
app_key: #<app_key>

# Show PV/UV of the website/page with busuanzi.
# Get more information on http://ibruce.info/2015/04/04/busuanzi/
busuanzi_count:
# count values only if the other configs are false
enable: false
# custom uv span for the whole site
site_uv: true
site_uv_header: <i class="fa fa-user"></i>
site_uv_footer:
# custom pv span for the whole site
site_pv: true
site_pv_header: <i class="fa fa-eye"></i>
site_pv_footer:
# custom pv span for one page only
page_pv: true
page_pv_header: <i class="fa fa-file-o"></i>
page_pv_footer:

# Tencent analytics ID
# tencent_analytics:
Expand Down
6 changes: 6 additions & 0 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
</span>
{% endif %}

{% if not is_index and theme.busuanzi_count.enable and theme.busuanzi_count.page_pv %}
&nbsp; | &nbsp;
<span class="page-pv">{{ theme.busuanzi_count.page_pv_header }}
<span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>{{ theme.busuanzi_count.page_pv_footer }}
</span>
{% endif %}
</div>
</header>
{% endif %}
Expand Down
12 changes: 12 additions & 0 deletions layout/_partials/footer.swig
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@
</a>
</div>

{% if theme.busuanzi_count.enable %}
<div class="busuanzi-count">
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
{% if theme.busuanzi_count.site_uv %}
<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>
{% endif %}
{% if theme.busuanzi_count.site_pv %}
<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>
{% endif %}
</div>
{% endif %}

{% block footer %}{% endblock %}
30 changes: 30 additions & 0 deletions source/css/_common/components/footer/footer.styl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,36 @@
}
}

.busuanzi-count {
&:before {
content: " ";
float: left;
width: 260px;
min-height: 25px;
}
}

.site-uv,
.site-pv,
.page-pv {
display: inline-block;

.busuanzi-value {
margin: 0 5px;
}
}

if hexo-config("busuanzi_count.site_pv") and hexo-config("busuanzi_count.site_uv")
.site-uv
{
margin-right: 10px;

&::after {
content: "|";
padding-left: 10px;
}
}

.cc-license {
margin-top: 10px;
text-align: center;
Expand Down