hexo-theme-stellar/layout/_partial/main/navbar/list_wiki.ejs

34 lines
866 B
Plaintext
Raw Normal View History

2021-07-04 20:21:31 +08:00
<%
function layoutDiv() {
var el = '';
2021-08-19 23:13:05 +08:00
el += '<div class="nav-wrap">';
2021-07-04 20:21:31 +08:00
el += '<nav class="sub wiki cap">';
// 所有项目
el += '<a';
if (page.filter === false) {
el += ' class="active"';
}
el += ' href="' + url_for(config.wiki_dir || "/wiki/") + '">' + __("btn.all_wiki") + '</a>';
el += '</a>';
// 项目分类
2023-12-06 13:22:07 +08:00
const { shelf, all_tags } = theme.wiki;
for (let id of Object.keys(all_tags)) {
let tag = all_tags[id];
let projects = tag.items.filter(item => shelf.includes(item))
2021-07-04 20:21:31 +08:00
if (projects && projects.length > 0) {
el += '<a';
2021-07-26 22:26:46 +08:00
if (tag.name && tag.name.length > 0 && page.tagName === tag.name) {
2021-07-04 20:21:31 +08:00
el += ' class="active"';
2021-02-20 13:09:41 +08:00
}
2021-07-26 22:26:46 +08:00
el += ' href="' + url_for(tag.path) + '">' + tag.name + '</a>';
2021-07-04 20:21:31 +08:00
el += '</a>';
2021-07-08 22:23:55 +08:00
}
2021-07-04 20:21:31 +08:00
}
el += '</nav>';
el += '</div>';
return el;
}
%>
<%- layoutDiv() %>