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

28 lines
697 B
Plaintext
Raw Normal View History

2022-10-22 13:03:47 +08:00
<%
function layoutDiv() {
2024-01-17 00:27:48 +08:00
var el = ''
el += `<nav class="menu dis-select${where == 'main' ? ' mobile-hidden' : ''}">`
2024-01-14 16:42:20 +08:00
for (let id of Object.keys(theme.menu)) {
2024-01-17 00:27:48 +08:00
let item = theme.menu[id]
2022-10-22 13:03:47 +08:00
if (item == undefined || item.length == 0) {
2024-01-17 00:27:48 +08:00
continue
2022-10-22 13:03:47 +08:00
}
2024-01-17 14:07:30 +08:00
el += `<a class="nav-item${id == page.menu_id ? ' active' : ''}" title="${item.title}" href="${url_for(item.url)}">`
if (item.icon?.length > 0) {
if (item.icon.startsWith('<img')) {
el += item.icon
} else {
el += `<img no-lazy src="${item.icon}">`
}
} else {
el += `<span>${__(item.title)}</span>`
}
2024-01-17 00:27:48 +08:00
el += `</a>`
2022-10-22 13:03:47 +08:00
}
2024-01-17 00:27:48 +08:00
el += `</nav>`
return el
2022-10-22 13:03:47 +08:00
}
%>
<%- layoutDiv() %>