From 10abbe21086c42b85657a2228e3491da9ee218ab Mon Sep 17 00:00:00 2001 From: XPoet Date: Wed, 20 Sep 2023 15:20:41 +0800 Subject: [PATCH] feat(front-matter): add home_cover and post_cover settings --- layout/article-content.ejs | 14 +++++++++----- layout/home-content.ejs | 8 +++++--- source/css/layout/article-content.styl | 1 - source/css/layout/home-content.styl | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/layout/article-content.ejs b/layout/article-content.ejs index 0e414918..9ac38d27 100644 --- a/layout/article-content.ejs +++ b/layout/article-content.ejs @@ -3,17 +3,21 @@
- <% if (page?.cover) { %> -
+ <% if (page?.post_cover || page?.home_cover) { %> +
<%= page.title %>
- <%= page.title %> +
<% } %> -
- <% if (!page?.cover) { %> +
+ <% if (!page?.post_cover && !page?.home_cover) { %>
<%= page.title %>
diff --git a/layout/home-content.ejs b/layout/home-content.ejs index a525131a..5919421e 100644 --- a/layout/home-content.ejs +++ b/layout/home-content.ejs @@ -3,16 +3,18 @@ <% page.posts.forEach(post => { %>
  • - <% if (post?.cover) { %> + <% if (post?.home_cover) { %>
    <% if (post.sticky) { %>
     <%- __('top') %>
    <% } %> - <%= post.title %> +
    <% } %> diff --git a/source/css/layout/article-content.styl b/source/css/layout/article-content.styl index 60f7b5cd..e45d7482 100644 --- a/source/css/layout/article-content.styl +++ b/source/css/layout/article-content.styl @@ -57,7 +57,6 @@ $spacer-padding = 2rem display flex align-items flex-end width 100% - height 13.8rem padding-top $spacer-padding padding-right $spacer-padding overflow hidden diff --git a/source/css/layout/home-content.styl b/source/css/layout/home-content.styl index 67362bbd..5c4e0ae3 100644 --- a/source/css/layout/home-content.styl +++ b/source/css/layout/home-content.styl @@ -61,7 +61,7 @@ height 6rem } - .cover-img { + .home-cover { width 100% height 100% object-fit cover