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

21 lines
485 B
Plaintext
Raw Normal View History

2024-01-19 23:19:25 +08:00
<%
function layoutDiv() {
var el = ''
2024-01-20 13:35:43 +08:00
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">`
2024-01-19 23:19:25 +08:00
if (item.icon) {
el += icon(item.icon)
}
2024-01-20 13:35:43 +08:00
if (columns <= 2) {
2024-01-19 23:19:25 +08:00
el += `<span>${item.title}</span>`
}
2024-01-20 13:35:43 +08:00
el += `</div>`
if (columns == 1 && isActive) {
el += icon('default:bookmark.active')
}
2024-01-19 23:19:25 +08:00
el += `</a>`
return el
}
%>
<%- layoutDiv() %>