diff --git a/layout/_partial/cover/index.ejs b/layout/_partial/cover/index.ejs new file mode 100644 index 0000000..b63c82b --- /dev/null +++ b/layout/_partial/cover/index.ejs @@ -0,0 +1,12 @@ +<% +function layoutCover() { + if (page.layout == 'wiki') { + return partial('wiki_cover'); + } + if (page.layout == 'post') { + return partial('post_cover'); + } + return ''; +} +%> +<%- layoutCover() %> diff --git a/layout/_partial/cover/post_cover.ejs b/layout/_partial/cover/post_cover.ejs new file mode 100644 index 0000000..425c214 --- /dev/null +++ b/layout/_partial/cover/post_cover.ejs @@ -0,0 +1,26 @@ +<% +function div() { + var el = ''; + if (page.banner == undefined || page.banner == false) { + return el; + } + el += '
'; + el += '
'; + if (theme.plugins.lazyload && theme.plugins.lazyload.enable) { + el += '
'; + } else { + el += '
'; + } + el += '
'; + if (page.title) { + el += '
'; + el += '

'; + el += page.title; + el += '

'; + el += '
'; + } + el += '
'; + return el; +} +%> +<%- div() %> diff --git a/layout/_partial/main/article/wiki_cover.ejs b/layout/_partial/cover/wiki_cover.ejs similarity index 92% rename from layout/_partial/main/article/wiki_cover.ejs rename to layout/_partial/cover/wiki_cover.ejs index a4c30bc..cc399f6 100644 --- a/layout/_partial/main/article/wiki_cover.ejs +++ b/layout/_partial/cover/wiki_cover.ejs @@ -1,9 +1,6 @@ <% function layoutWikiCover() { var el = ''; - if (page.layout !== 'wiki') { - return el; - } let proj = theme.wiki.projects[page.wiki]; if (proj == undefined) { return el; @@ -21,7 +18,7 @@ function layoutWikiCover() { if (cover === true) { cover = ['logo', 'title', 'description']; } - el += '
'; + el += '
'; el += '
'; if (logo && logo.src && cover.includes('logo')) { diff --git a/layout/_partial/main/post_list/post_card.ejs b/layout/_partial/main/post_list/post_card.ejs index 5d32216..416e4fc 100755 --- a/layout/_partial/main/post_list/post_card.ejs +++ b/layout/_partial/main/post_list/post_card.ejs @@ -1,7 +1,7 @@ <% -function layoutDiv() { +function div_default() { var el = ''; - + el += '
'; // 标题 el += '

'; el += (post.title || post.seo_title) ? (post.title || post.seo_title) : date(post.date, config.date_format); @@ -43,12 +43,36 @@ function layoutDiv() { } } } + el += '

'; if (post.pin) { el += ''; } - el += '
'; - + el += ''; return el; } +function div_photo() { + var el = ''; + el += '
'; + el += ''; + el += '
'; + el += ''; + el += __("meta.created") + ' ' + ''; + el += ''; + el += '
'; + el += '
'; + + el += '
'; + el += '

'; + el += post.title; + el += '

'; + el += '
'; + return el; +} +function div() { + if (post.cover && post.cover.length > 0) { + return div_photo(); + } + return div_default(); +} %> -<%- layoutDiv() %> +<%- div() %> diff --git a/layout/_partial/main/post_list/wiki_card.ejs b/layout/_partial/main/post_list/wiki_card.ejs index 96303af..456f33b 100644 --- a/layout/_partial/main/post_list/wiki_card.ejs +++ b/layout/_partial/main/post_list/wiki_card.ejs @@ -1,6 +1,7 @@ <% function layoutDiv() { var el = ''; + el += '
'; if (proj.logo && proj.logo.src) { el += '
'; el += 'logo'; } el += '
'; + el += '
'; return el; } %> diff --git a/layout/index.ejs b/layout/index.ejs index 33c6424..3e6373c 100755 --- a/layout/index.ejs +++ b/layout/index.ejs @@ -12,10 +12,13 @@ if (page.title && page.wiki) { function layout_post_card(layout, post, content) { var el = ''; + var layout = layout; + if (layout == 'post' && post.cover != undefined) { + layout += ' photo'; + } el += ''; - el += '
'; el += content; - el += '
'; + el += ''; return el; } diff --git a/layout/layout.ejs b/layout/layout.ejs index 5e7199c..1e1e36b 100755 --- a/layout/layout.ejs +++ b/layout/layout.ejs @@ -2,7 +2,7 @@ <%- partial('_partial/head') %> - <%- partial('_partial/main/article/wiki_cover') %> + <%- partial('_partial/cover/index') %>