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

32 lines
790 B
Plaintext

<%
function layoutDiv() {
var el = ''
el += `<nav class="menu dis-select${where == 'main' ? ' mobile-hidden' : ''}">`
for (let id of Object.keys(theme.menu)) {
let item = theme.menu[id]
if (item == undefined || item.length == 0) {
continue
}
el += `<a class="nav-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 {
el += `<img no-lazy src="${item.icon}">`
}
} else {
el += `<span>${__(item.title)}</span>`
}
el += `</a>`
}
el += `</nav>`
return el
}
%>
<%- layoutDiv() %>