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

44 lines
886 B
Plaintext
Raw Normal View History

2021-02-21 03:13:21 +08:00
<%
function layoutMainMenu() {
var el = '';
2021-06-26 15:02:32 +08:00
el += partial('logo');
2021-03-05 21:37:28 +08:00
el += '<nav class="menu dis-select">'
2021-02-21 03:13:21 +08:00
for (let id of Object.keys(theme.sidebar.menu)) {
let item = theme.sidebar.menu[id];
2021-02-24 21:27:31 +08:00
if (item == undefined || item.length == 0) {
2021-02-22 13:37:58 +08:00
continue;
}
2021-02-21 03:13:21 +08:00
el += '<a class="nav-item';
if (id == page.menu_id) {
el += ' active';
}
2021-02-24 21:27:31 +08:00
el += '" href="' + url_for(md_link(item)) + '">';
el += __(md_text(item));
2021-02-21 03:13:21 +08:00
el += '</a>';
}
el += '</nav>';
return el;
}
2021-06-26 15:02:32 +08:00
function layoutWikiMenu() {
var el = '';
el += partial('logo');
return el;
}
function layoutDiv() {
var el = '';
el += '<header class="header';
if (where == 'main') {
el += ' mobile-only';
}
el += '">';
if (page.layout === 'wiki') {
el += layoutWikiMenu();
} else {
el += layoutMainMenu();
}
el += '</header>';
return el;
}
2021-02-21 03:13:21 +08:00
%>
2021-06-26 15:02:32 +08:00
<%- layoutDiv() %>