hexo-theme-stellar/layout/index.ejs

64 lines
1.9 KiB
Plaintext
Executable File

<%
if (page.class == undefined) {
if (page.layout == 'index' && page.title && page.wiki) {
page.class = 'wiki';
} else {
page.class = 'post';
}
}
%>
<% if (page.class == 'post') { %>
<%- partial('_partial/main/navbar/list_post') %>
<% if (page.posts) { %>
<div class='post-list post'>
<% page.posts.each(function(post){ %>
<a class='post-card post reveal' href='<%- url_for(post.link || post.path) %>'>
<article class='excerpt md'>
<%- partial('_partial/main/post_list/post_card', {post: post}) %>
</article>
</a>
<% }) %>
<%- partial('_partial/main/post_list/paginator') %>
</div>
<% } %>
<% } else if (page.class == 'wiki') { %>
<% function outputExcerpt(post) { %>
<a class='post-card wiki reveal' href='<%- url_for(post.link || post.path) %>'>
<article class='excerpt md'>
<%- partial('_partial/main/post_list/wiki_card', {post: post}) %>
</article>
</a>
<% } %>
<%- partial('_partial/main/navbar/list_wiki') %>
<% if (page.title && page.wiki) { %>
<div class='post-list wiki filter'>
<% page.wiki.forEach((wiki, i) => { %>
<% site.pages.filter(function (p) { %>
<% return p.layout == 'wiki' && p.wiki == wiki && p.description; %>
<% }).limit(1).each(function(post) { %>
<%- outputExcerpt(post) %>
<% }); %>
<% }); %>
</div>
<% } else { %>
<div class='post-list wiki'>
<%
var wikis = [];
wikis = site.pages.filter(function (p) {
if (p.layout == 'wiki' && p.wiki && p.description) {
if (p.order == undefined) {
p.order = 0;
}
return true;
} else {
return false;
}
}).sort('order');
%>
<% wikis.forEach(function(post) { %>
<%- outputExcerpt(post) %>
<% }); %>
</div>
<% } %>
<% } %>