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

49 lines
962 B
Plaintext
Raw Normal View History

2021-02-21 03:13:21 +08:00
<%
2021-07-04 20:21:31 +08:00
function layoutMenu() {
var el = '';
2021-08-19 23:13:05 +08:00
el += '<nav class="menu dis-select';
if (where == 'main') {
el += ' mobile-hidden';
2021-07-04 20:21:31 +08:00
}
2021-08-19 23:13:05 +08:00
el += '">';
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 layoutDiv() {
var el = '';
el += '<header class="header';
if (where == 'main') {
el += ' mobile-only';
}
el += '">';
2021-07-04 20:21:31 +08:00
el += partial('logo');
2021-08-19 23:13:05 +08:00
if (where != 'main') {
if (page.layout === 'wiki' && page.wiki) {
if (page.menu_id !== 'wiki') {
el += layoutMenu();
}
} else {
2021-07-04 20:21:31 +08:00
el += layoutMenu();
}
2021-06-26 15:02:32 +08:00
}
2021-08-19 23:13:05 +08:00
2021-06-26 15:02:32 +08:00
el += '</header>';
return el;
}
2021-02-21 03:13:21 +08:00
%>
2021-06-26 15:02:32 +08:00
2021-07-04 20:21:31 +08:00
<%- layoutDiv() %>