const { Component } = require('inferno'); const { cacheComponent } = require('hexo-component-inferno/lib/util/cache'); class Footer extends Component { render() { const { logo, logoUrl, siteUrl, siteTitle, siteYear, author, links, showVisitorCounter, visitorCounterTitle } = this.props; let footerLogo = ''; if (logo) { if (logo.text) { footerLogo = logo.text; } else { footerLogo = {siteTitle}; } } else { footerLogo = siteTitle; } return ; } } module.exports = cacheComponent(Footer, 'common.footer', props => { const { config, helper } = props; const { url_for, _p, date } = helper; const { logo, title, author, footer, plugins } = config; const links = {}; if (footer && footer.links) { Object.keys(footer.links).forEach(name => { const link = footer.links[name]; links[name] = { url: url_for(typeof link === 'string' ? link : link.url), icon: link.icon }; }); } return { logo, logoUrl: url_for(logo), siteUrl: url_for('/'), siteTitle: title, siteYear: date(new Date(), 'YYYY'), author, links, showVisitorCounter: plugins && plugins.busuanzi === true, visitorCounterTitle: _p('plugin.visitor_count', '0') }; });