hexo-theme-stellar/layout/_partial/cover/wiki_cover.ejs

51 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 = '';
let proj = theme.wiki.projects[page.wiki];
2021-07-26 22:26:46 +08:00
if (proj == undefined) {
2021-07-09 21:17:55 +08:00
return el;
2021-02-19 23:33:19 +08:00
}
2021-07-26 22:26:46 +08:00
if (proj.homepage.path !== page.path) {
2021-07-09 21:17:55 +08:00
return;
2021-02-19 23:33:19 +08:00
}
2021-07-26 22:26:46 +08:00
if (proj.cover == undefined || proj.cover === false || proj.cover === '[]') {
2021-07-09 21:17:55 +08:00
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'];
}
el += '<div class="l_cover wiki' + scrollreveal() + '">';
2022-11-23 22:44:11 +08:00
el += '<article class="cover-wrap md-text">';
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">';
2022-12-15 22:42:48 +08:00
el += '<a class="button start" href="#start">' + (proj.start || __('btn.getting_started')) + '</a>';
2021-02-19 23:33:19 +08:00
el += '</div>';
el += '</article>';
el += '</div>';
el += '<hr>';
return el;
}
%>
<%- layoutWikiCover() %>