From 1d4cf1e9c8c7ca39af0872dbcc839bdbf7f56630 Mon Sep 17 00:00:00 2001 From: Rainanxu Date: Mon, 30 Sep 2024 21:47:22 +0800 Subject: [PATCH] Add banner images center. --- _config.yml | 13 +++++++++++++ layout/404.ejs | 1 + layout/_partials/header/banner.ejs | 3 ++- layout/about.ejs | 1 + layout/archive.ejs | 1 + layout/categories.ejs | 1 + layout/category.ejs | 1 + layout/links.ejs | 1 + layout/page.ejs | 1 + layout/post.ejs | 1 + layout/tag.ejs | 1 + layout/tags.ejs | 1 + 12 files changed, 25 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 6cc364d5..37f249d2 100644 --- a/_config.yml +++ b/_config.yml @@ -484,6 +484,11 @@ index: # Path of Banner image, can be a relative path or an absolute path, the same on other pages banner_img: /img/default.png + # 头图中心位置,两个百分比,从左到右,从上到下 + # Center of banner image,two percentages, left to right, top to bottom + # Available: 0% - 100% or a description of the location, such as "center top" + banner_img_center: 50% 50% + # 头图高度,屏幕百分比 # Height ratio of banner image # Available: 0 - 100 @@ -555,6 +560,7 @@ index: #--------------------------- post: banner_img: /img/default.png + banner_img_center: banner_img_height: 70 banner_mask_alpha: 0.3 @@ -919,6 +925,7 @@ discuss: #--------------------------- archive: banner_img: /img/default.png + banner_img_center: banner_img_height: 60 banner_mask_alpha: 0.3 @@ -930,6 +937,7 @@ archive: category: enable: true banner_img: /img/default.png + banner_img_center: banner_img_height: 60 banner_mask_alpha: 0.3 @@ -959,6 +967,7 @@ category: tag: enable: true banner_img: /img/default.png + banner_img_center: banner_img_height: 80 banner_mask_alpha: 0.3 tagcloud: @@ -976,6 +985,7 @@ tag: about: enable: true banner_img: /img/default.png + banner_img_center: banner_img_height: 60 banner_mask_alpha: 0.3 avatar: /img/avatar.png @@ -998,6 +1008,7 @@ about: #--------------------------- page: banner_img: /img/default.png + banner_img_center: banner_img_height: 60 banner_mask_alpha: 0.3 @@ -1009,6 +1020,7 @@ page: page404: enable: true banner_img: /img/default.png + banner_img_center: banner_img_height: 85 banner_mask_alpha: 0.3 # 重定向到首页的延迟(毫秒) @@ -1023,6 +1035,7 @@ page404: links: enable: true banner_img: /img/default.png + banner_img_center: banner_img_height: 60 banner_mask_alpha: 0.3 # 友链的成员项 diff --git a/layout/404.ejs b/layout/404.ejs index b4364df9..663b2338 100644 --- a/layout/404.ejs +++ b/layout/404.ejs @@ -3,6 +3,7 @@ page.layout = "404" page.title = theme.page404.title || __('page404.title') page.subtitle = theme.page404.subtitle || __('page404.subtitle') page.banner_img = theme.page404.banner_img +page.banner_img_center = theme.page404.banner_img_center page.banner_img_height = theme.page404.banner_img_height page.banner_mask_alpha = theme.page404.banner_mask_alpha %> diff --git a/layout/_partials/header/banner.ejs b/layout/_partials/header/banner.ejs index a8c554df..db8c004b 100644 --- a/layout/_partials/header/banner.ejs +++ b/layout/_partials/header/banner.ejs @@ -1,12 +1,13 @@ <% var banner_img = page.banner_img || theme.index.banner_img +var banner_img_center = page.banner_img_center || theme.index.banner_img_center var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height) var banner_mask_alpha = parseFloat(page.banner_mask_alpha || theme.index.banner_mask_alpha) var subtitle = page.subtitle || page.title %>