71 lines
2.0 KiB
Plaintext
71 lines
2.0 KiB
Plaintext
<%
|
|
function layoutDiv() {
|
|
var prev,next;
|
|
var title = __('meta.read_next');
|
|
var title_prev = __('meta.prev');
|
|
var title_next = __('meta.next');
|
|
if (page.layout == 'post') {
|
|
prev = page.prev;
|
|
next = page.next;
|
|
title_prev = __('meta.newer');
|
|
title_next = __('meta.older');
|
|
} else if (page.layout == 'wiki' && page.wiki && page.wiki.length > 0) {
|
|
var wikis = [];
|
|
wikis = site.pages.filter(function (p) {
|
|
if (p.layout == 'wiki' && p.wiki && p.wiki == page.wiki) {
|
|
if (p.order == undefined) {
|
|
p.order = 0;
|
|
}
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}).sort('order');
|
|
page.order = page.order || 0;
|
|
wikis.forEach((p, i) => {
|
|
if (p.order < page.order) {
|
|
if (prev == undefined || p.order > prev.order) {
|
|
prev = p;
|
|
}
|
|
} else if (p.order > page.order) {
|
|
if (next == undefined || p.order < next.order) {
|
|
next = p;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
let el = '';
|
|
if (prev || next) {
|
|
el += '<div class="related-wrap" id="read-next">';
|
|
el += '<section class="header cap theme">';
|
|
el += '<span>' + title + '</span>';
|
|
el += '</section>';
|
|
el += '<section class="body fs14">';
|
|
if (next) {
|
|
el += '<a id="next" href="' + url_for(next.path) + '">';
|
|
el += next.title || next.seo_title || next.wiki;
|
|
el += '<span class="note">' + title_next + '</span>';
|
|
el += '</a>';
|
|
}
|
|
el += '<div class="line"></div>';
|
|
if (prev) {
|
|
el += '<a id="prev" href="' + url_for(prev.path) + '">';
|
|
el += prev.title || prev.seo_title || prev.wiki;
|
|
el += '<span class="note">' + title_prev + '</span>';
|
|
el += '</a>';
|
|
}
|
|
if (page.layout == 'post') {
|
|
el += '<div class="line"></div>';
|
|
el += '<a id="more" href="' + url_for(config.archive_dir) + '">';
|
|
el += __('meta.all_articles');
|
|
el += '<span class="note">' + __('btn.archives') + '</span>';
|
|
el += '</a>';
|
|
}
|
|
el += '</section>';
|
|
el += '</div>';
|
|
}
|
|
return el;
|
|
}
|
|
%>
|
|
<%- layoutDiv(); %>
|