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

29 lines
875 B
Plaintext
Raw Normal View History

2021-02-20 13:09:41 +08:00
<div class='nav-wrap'>
<nav class='sub wiki cap green'>
<% if (page.layout == 'index' && page.title && page.wiki) { %>
<a href='/wiki/'><%- __('btn.all_wiki') %></a>
<% } else { %>
<a class='active' href='/wiki/'><%- __('btn.all_wiki') %></a>
<% } %>
<%
var groups = [];
var paths = [];
site.pages.filter(function (p) {
return p.layout == 'index' && p.title && p.wiki;
}).sort('order').each(function(p) {
if (groups.includes(p.wiki) == false) {
groups.push(p.title);
paths.push(p.path);
}
});
%>
<% groups.forEach((group, i) => { %>
<% if (page.title == group) { %>
<a class='active' href='<%- url_for(paths[i]) %>'><%- group %></a>
<% } else { %>
<a class='' href='<%- url_for(paths[i]) %>'><%- group %></a>
<% } %>
<% }); %>
</nav>
</div>