'use strict'; const { Component } = require('inferno'); const { cacheComponent } = require('../util/cache'); class Tags extends Component { render() { const { tags, title, showCount } = this.props; return
; } } module.exports = cacheComponent(Tags, 'widget.tags', props => { // adapted from hexo/lib/plugins/helper/list_tags.js let tags = props.tags || props.site.tags; if (!tags.length) { return null; } const { orderBy = 'name', order = 1, amount, url_for, _p } = props; const showCount = Object.prototype.hasOwnProperty.call(props, 'show_count') ? props.show_count : true; tags = tags.sort(orderBy, order).filter(tag => tag.length); if (amount) { tags = tags.limit(amount); } return { showCount, title: _p('common.tag', Infinity), tags: tags.map(tag => ({ name: tag.name, count: tag.length, url: url_for(tag.path) })) }; });