Add Page View Count to Hexo Icarus Theme

In the latest updates to Hexo Icarus theme, the page view count is not showing by default.

To add page view count at the footer section, we need to modify the code a little bit.

Modify /node_modules/hexo-theme-icarus/layout/common/footer.jsx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
showVisitorCounter,
visitorCounterTitle,
showPageViewCounter, // added
pageViewCounterTitle // added


{showVisitorCounter ? <br /> : null}
{showVisitorCounter ? <span id="busuanzi_container_site_uv"
dangerouslySetInnerHTML={{ __html: visitorCounterTitle }}></span> : null}

// added
{showPageViewCounter ? <br /> : null}
{showPageViewCounter ? <span id="busuanzi_container_site_pv"
dangerouslySetInnerHTML={{ __html: pageViewCounterTitle }}></span> : null}

showVisitorCounter: plugins && plugins.busuanzi === true,
visitorCounterTitle: _p('plugin.visitor_count', '<span id="busuanzi_value_site_uv">0</span>'),
// added
showPageViewCounter: plugins && plugins.busuanzi === true,
pageViewCounterTitle: _p('plugin.visit', '<span id="busuanzi_value_site_pv">0</span>')

Modify node_modules/hexo-theme-icarus/languages/en.yml

1
2
3
4
5
plugin:
backtotop: 'Back to top'
visit_count: '%s&nbsp;visits'
visitor_count: 'uv %s'
visit: 'pv %s'
Author

Joe Chu

Posted on

2025-02-21

Updated on

2025-02-21

Licensed under

Comments