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

44 lines
1.3 KiB
Plaintext
Raw Normal View History

2021-02-19 23:33:19 +08:00
<%
function layoutWikiCover() {
if (page.layout != 'wiki') {
return '';
}
if (page.cover == undefined || page.cover == false || page.cover == '[]') {
return '';
}
var cover = page.cover;
if (page.cover == true) {
cover = ['logo', 'title', 'description'];
}
var el = '';
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-04 20:21:31 +08:00
let proj = theme.wiki.projects[page.wiki];
if (proj.logo && proj.logo.src && cover.includes('logo')) {
2021-02-24 00:32:07 +08:00
el += '<div class="preview">';
2021-07-04 20:21:31 +08:00
if (proj.logo.large) {
el += '<img src="' + proj.logo.src + '" height="' + proj.logo.large + '">';
2021-02-19 23:33:19 +08:00
} else {
2021-07-04 20:21:31 +08:00
el += '<img src="' + proj.logo.src + '">';
2021-02-19 23:33:19 +08:00
}
el += '</div>';
}
2021-07-04 20:21:31 +08:00
if ((proj.title || page.title) && cover.includes('title')) {
2021-02-19 23:33:19 +08:00
el += '<div class="cover-title">';
2021-07-04 20:21:31 +08:00
el += '<span>' + (proj.title || page.title) + '</span>';
2021-02-19 23:33:19 +08:00
el += '</div>';
}
2021-07-04 20:21:31 +08:00
if ((proj.description || page.description) && cover.includes('description')) {
el += '<div class="description">' + (proj.description || page.description) + '</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() %>