Skip to content

Commit 1df7acb

Browse files
committed
ui: optimize footer style (#326)
1 parent 7afe092 commit 1df7acb

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

layout/_partial/footer.ejs

+28-19
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,26 @@
22
const {
33
since: f_since,
44
record: f_record,
5-
site_deploy: f_site_deploy
5+
site_deploy: f_site_deploy,
6+
word_count: f_word_count
67
} = theme?.footer || {}
78
const { author: bi_author } = theme?.base_info || {}
89
const { author: hexo_author } = config
910
const { site_uv: bsz_site_uv, site_pv: bsz_site_pv, enable: bsz_enable } = theme?.website_count?.busuanzi_count || {}
1011
const web_master = bi_author || hexo_author
12+
13+
const show_pv = bsz_enable === true && bsz_site_pv === true
14+
const show_uv = bsz_enable === true && bsz_site_uv === true
15+
16+
let f_temp_total_word = 0
17+
try {
18+
f_temp_total_word = totalcount(site)
19+
} catch {
20+
f_temp_total_word = 0
21+
}
22+
const show_word_count = f_word_count === true && f_temp_total_word !== 0
23+
24+
const has_count_info = show_pv || show_uv || show_word_count
1125
%>
1226
<footer class="footer border-box">
1327
<div class="copyright-info info-item">
@@ -37,35 +51,30 @@ const web_master = bi_author || hexo_author
3751
</div>
3852
<% } %>
3953
40-
<div class="count-info info-item">
41-
<%
42-
let f_temp_total_word;
43-
try {
44-
f_temp_total_word = totalcount(site);
45-
} catch (e) {
46-
f_temp_total_word = 0;
47-
}
48-
if (theme.footer?.word_count === true && f_temp_total_word !== 0) { %>
49-
<span class="count-item border-box word">
54+
<% if (has_count_info) { %>
55+
<div class="count-info info-item">
56+
<% if (show_word_count) { %>
57+
<span class="count-item border-box word">
5058
<span class="item-type border-box"><%- __('footer.total_words') %></span>
5159
<span class="item-value border-box word"><%= totalcount(site) %></span>
5260
</span>
53-
<% } %>
61+
<% } %>
5462
55-
<% if (bsz_enable === true && bsz_site_uv === true) { %>
56-
<span class="count-item border-box uv">
63+
<% if (show_uv) { %>
64+
<span class="count-item border-box uv">
5765
<span class="item-type border-box"><%- __('footer.site_uv') %></span>
5866
<span class="item-value border-box uv" id="busuanzi_value_site_uv"></span>
5967
</span>
60-
<% } %>
68+
<% } %>
6169
62-
<% if (bsz_enable === true && bsz_site_pv === true) { %>
63-
<span class="count-item border-box pv">
70+
<% if (show_pv) { %>
71+
<span class="count-item border-box pv">
6472
<span class="item-type border-box"><%- __('footer.site_pv') %></span>
6573
<span class="item-value border-box pv" id="busuanzi_value_site_pv"></span>
6674
</span>
67-
<% } %>
68-
</div>
75+
<% } %>
76+
</div>
77+
<% } %>
6978
7079
<% if (f_record?.enable === true) { %>
7180
<div class="record-info info-item">

0 commit comments

Comments
 (0)