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

31 lines
782 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-17 23:39:14 +08:00
for (let item of theme.menubar.items) {
if (item == undefined || item.id == null || item.url == null) {
2024-01-17 00:27:48 +08:00
continue
2022-10-22 13:03:47 +08:00
}
2024-01-17 23:39:14 +08:00
el += `<a class="nav-item${item.id == page.menu_id ? ' active' : ''}" title="${item.title}" href="${url_for(item.url)}"`
2024-01-17 22:57:52 +08:00
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() %>