hexo-theme-stellar/layout/index.ejs

67 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2021-02-19 23:33:19 +08:00
<%
2021-02-21 03:13:21 +08:00
if (page.menu_id == undefined) {
2021-02-19 23:33:19 +08:00
if (page.layout == 'index' && page.title && page.wiki) {
2021-02-21 03:13:21 +08:00
page.menu_id = 'wiki';
2021-02-19 23:33:19 +08:00
} else {
2021-02-21 03:13:21 +08:00
page.menu_id = 'post';
2021-02-19 23:33:19 +08:00
}
}
2021-02-21 13:44:11 +08:00
if (page.title && page.wiki) {
page.robots = 'noindex,follow';
}
2021-02-19 23:33:19 +08:00
%>
2021-02-21 03:13:21 +08:00
<% if (page.menu_id == 'post') { %>
2021-02-20 13:09:41 +08:00
<%- partial('_partial/main/navbar/list_post') %>
2021-02-19 23:33:19 +08:00
<% if (page.posts) { %>
<div class='post-list post'>
<% page.posts.each(function(post){ %>
2021-02-22 13:19:21 +08:00
<a class='post-card post<%- scrollreveal() %>' href='<%- url_for(post.link || post.path) %>'>
2021-02-19 23:33:19 +08:00
<article class='excerpt md'>
2021-02-20 13:09:41 +08:00
<%- partial('_partial/main/post_list/post_card', {post: post}) %>
2021-02-19 23:33:19 +08:00
</article>
</a>
<% }) %>
2021-02-20 13:09:41 +08:00
<%- partial('_partial/main/post_list/paginator') %>
2021-02-19 23:33:19 +08:00
</div>
<% } %>
2021-02-21 03:13:21 +08:00
<% } else if (page.menu_id == 'wiki') { %>
2021-02-19 23:33:19 +08:00
<% function outputExcerpt(post) { %>
2021-02-22 13:19:21 +08:00
<a class='post-card wiki<%- scrollreveal() %>' href='<%- url_for(post.link || post.path) %>'>
2021-02-19 23:33:19 +08:00
<article class='excerpt md'>
2021-02-20 13:09:41 +08:00
<%- partial('_partial/main/post_list/wiki_card', {post: post}) %>
2021-02-19 23:33:19 +08:00
</article>
</a>
<% } %>
2021-02-20 13:09:41 +08:00
<%- partial('_partial/main/navbar/list_wiki') %>
2021-02-19 23:33:19 +08:00
<% 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>
<% } %>
<% } %>