hexo-theme-stellar/layout/_partial/widgets/components/link.ejs

21 lines
485 B
Plaintext

<%
function layoutDiv() {
var el = ''
const isActive = url_for(item.url) == url_for(page.path)
el += `<a class="link${isActive ? ' active' : ''}" title="${item.title}" href="${item.url}">`
el += `<div class="flex">`
if (item.icon) {
el += icon(item.icon)
}
if (columns <= 2) {
el += `<span>${item.title}</span>`
}
el += `</div>`
if (columns == 1 && isActive) {
el += icon('default:bookmark.active')
}
el += `</a>`
return el
}
%>
<%- layoutDiv() %>