5 * Modified from the hexo version,
6 * https://github.com/hexojs/hexo/blob/master/lib/plugins/helper/link_to.js
7 * to remove title attribute and 'external' option
10 const { htmlTag } = require('hexo-util')
12 hexo.extend.helper.register('link', (path, text) => {
13 const urlFor = hexo.extend.helper.get('url_for').bind(hexo)
15 if (!text) text = path.replace(/^https?:\/\/|\/$/g, '')
17 const attrs = Object.assign({
21 if (attrs.class && Array.isArray(attrs.class)) {
22 attrs.class = attrs.class.join(' ')
25 return htmlTag('a', attrs, text)