hexo-theme-stellar/layout/_partial/sidebar/menu.ejs

33 lines
862 B
Plaintext

<%
function layoutDiv() {
var el = ''
el += `<nav class="menu dis-select${where == 'main' ? ' mobile-hidden' : ''}">`
for (let item of theme.menubar.items) {
if (item == undefined || item.id == null || item.url == null) {
continue
}
el += `<a class="nav-item${item.id == page.menu_id ? ' active' : ''}" title="${item.title}" href="${url_for(item.url)}"`
if (item.theme?.length > 0) {
el += ` style="color:${item.theme}"`
}
el += `>`
if (item.icon?.length > 0) {
if (item.icon.startsWith('<')) {
el += item.icon
} else if (theme.icons[item.icon]) {
el += theme.icons[item.icon]
} else {
el += `<img no-lazy src="${item.icon}">`
}
} else {
el += `<span>${__(item.title)}</span>`
}
el += `</a>`
}
el += `</nav>`
return el
}
%>
<%- layoutDiv() %>