hexo-theme-stellar/layout/_partial/main/article/wiki_cover.ejs

54 lines
1.4 KiB
Plaintext
Raw Normal View History

2021-02-19 23:33:19 +08:00
<%
function layoutWikiCover() {
2021-07-09 21:17:55 +08:00
var el = '';
if (page.layout !== 'wiki') {
return el;
}
let proj = theme.wiki.projects[page.wiki];
if (proj === undefined) {
return el;
2021-02-19 23:33:19 +08:00
}
2021-07-09 21:17:55 +08:00
if (proj.path !== page.path) {
return;
2021-02-19 23:33:19 +08:00
}
2021-07-09 21:17:55 +08:00
if (proj.cover === undefined || proj.cover === false || proj.cover === '[]') {
return el;
}
var cover = proj.cover;
let logo = proj.logo;
let title = proj.title || page.title;
let desc = proj.description || page.description;
if (cover === true) {
2021-02-19 23:33:19 +08:00
cover = ['logo', 'title', 'description'];
}
2021-02-22 13:19:21 +08:00
el += '<div class="l_cover' + scrollreveal() + '">';
2021-02-19 23:33:19 +08:00
el += '<article class="cover-wrap md">';
2021-07-09 21:17:55 +08:00
if (logo && logo.src && cover.includes('logo')) {
2021-02-24 00:32:07 +08:00
el += '<div class="preview">';
2021-07-09 21:17:55 +08:00
if (logo.large) {
el += '<img src="' + logo.src + '" height="' + logo.large + '">';
2021-02-19 23:33:19 +08:00
} else {
2021-07-09 21:17:55 +08:00
el += '<img src="' + logo.src + '">';
2021-02-19 23:33:19 +08:00
}
el += '</div>';
}
2021-07-09 21:17:55 +08:00
if (title && cover.includes('title')) {
2021-02-19 23:33:19 +08:00
el += '<div class="cover-title">';
2021-07-09 21:17:55 +08:00
el += '<span>' + title + '</span>';
2021-02-19 23:33:19 +08:00
el += '</div>';
}
2021-07-09 21:17:55 +08:00
if (desc && cover.includes('description')) {
el += '<div class="description">' + desc + '</div>';
2021-02-19 23:33:19 +08:00
}
el += '<div class="start-wrap">';
2021-02-28 18:19:32 +08:00
el += '<a class="button theme start" href="#start">' + __('btn.getting_started') + '</a>';
2021-02-19 23:33:19 +08:00
el += '</div>';
el += '</article>';
el += '</div>';
el += '<hr>';
return el;
}
%>
<%- layoutWikiCover() %>