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

32 lines
790 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 22:57:52 +08:00
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 += `>`
2024-01-17 14:07:30 +08:00
if (item.icon?.length > 0) {
2024-01-17 22:57:52 +08:00
if (item.icon.startsWith('<')) {
2024-01-17 14:07:30 +08:00
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() %>