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

45 lines
1.3 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 = '';
2024-01-19 01:05:44 +08:00
const proj = theme.wiki.tree[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
}
2023-12-21 23:59:53 +08:00
if (proj.coverpage == undefined || proj.coverpage === false || proj.coverpage === '[]') {
2021-07-09 21:17:55 +08:00
return el;
}
2023-12-21 23:59:53 +08:00
var coverpage = proj.coverpage;
let cover = proj.cover;
2021-07-09 21:17:55 +08:00
let title = proj.title || page.title;
let desc = proj.description || page.description;
2023-12-21 23:59:53 +08:00
if (coverpage === true) {
coverpage = ['cover', 'title', 'description'];
2021-02-19 23:33:19 +08:00
}
2024-01-19 01:05:44 +08:00
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
2023-12-21 23:59:53 +08:00
if (cover?.length > 0 && coverpage.includes('cover')) {
el += `<div class="preview cover"><img src="${cover}"/></div>`
2021-02-19 23:33:19 +08:00
}
2023-12-21 23:59:53 +08:00
if (title && coverpage.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>';
}
2023-12-21 23:59:53 +08:00
if (desc && coverpage.includes('description')) {
2021-07-09 21:17:55 +08:00
el += '<div class="description">' + desc + '</div>';
2021-02-19 23:33:19 +08:00
}
el += '<div class="start-wrap">';
2022-12-16 14:53:08 +08:00
el += '<a class="button start gradient" 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() %>