2021-02-19 23:33:19 +08:00
|
|
|
<%
|
|
|
|
// 默认组件
|
|
|
|
if (page.sidebar == undefined) {
|
|
|
|
if (page.layout == 'post' && page.content) {
|
|
|
|
page.sidebar = ['toc', 'recent'];
|
|
|
|
} else if (page.layout == 'wiki' && page.content) {
|
|
|
|
page.sidebar = ['toc', 'wiki_more'];
|
|
|
|
} else {
|
2021-02-25 20:49:43 +08:00
|
|
|
page.sidebar = theme.sidebar.widgets.default;
|
2021-02-19 23:33:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function layoutFooterDiv() {
|
|
|
|
if (theme.footer.social && theme.footer.social.length > 0) {
|
|
|
|
var el = '<footer class="footer"><div class="social-wrap">';
|
|
|
|
theme.footer.social.forEach(item => {
|
|
|
|
if (item.icon && item.url) {
|
2021-02-27 17:49:37 +08:00
|
|
|
el += '<a class="social" href="' + url_for(item.url) + '" target="_blank" rel="external nofollow noopener noreferrer">' + item.icon + '</a>';
|
2021-02-19 23:33:19 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
el += '</div></footer>';
|
|
|
|
return el;
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
%>
|
|
|
|
<div class='wrap'>
|
|
|
|
<%- partial('header') %>
|
|
|
|
<div class='widgets'>
|
|
|
|
<% page.sidebar.forEach(function(widget){ %>
|
|
|
|
<% if (widget in theme.sidebar.widgets) { %>
|
|
|
|
<% let w = theme.sidebar.widgets[widget]; %>
|
|
|
|
<%- partial('widgets/' + w.layout, {item: w}) %>
|
|
|
|
<% } %>
|
|
|
|
<% }) %>
|
|
|
|
</div>
|
|
|
|
<%- layoutFooterDiv() %>
|
|
|
|
</div>
|