Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加 banner 图片自定义中心。 #1139

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -555,6 +560,7 @@ index:
#---------------------------
post:
banner_img: /img/default.png
banner_img_center:
banner_img_height: 70
banner_mask_alpha: 0.3

Expand Down Expand Up @@ -919,6 +925,7 @@ discuss:
#---------------------------
archive:
banner_img: /img/default.png
banner_img_center:
banner_img_height: 60
banner_mask_alpha: 0.3

Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -998,6 +1008,7 @@ about:
#---------------------------
page:
banner_img: /img/default.png
banner_img_center:
banner_img_height: 60
banner_mask_alpha: 0.3

Expand All @@ -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
# 重定向到首页的延迟(毫秒)
Expand All @@ -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
# 友链的成员项
Expand Down
1 change: 1 addition & 0 deletions layout/404.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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
%>
Expand Down
3 changes: 2 additions & 1 deletion layout/_partials/header/banner.ejs
Original file line number Diff line number Diff line change
@@ -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
%>

<div id="banner" class="banner" <%- theme.banner && theme.banner.parallax && 'parallax=true' %>
style="background: url('<%- url_for(banner_img) %>') no-repeat center center; background-size: cover;">
style="background: url('<%- url_for(banner_img) %>') no-repeat <%= banner_img_center %>; background-size: cover;">
<div class="full-bg-img">
<div class="mask flex-center" style="background-color: rgba(0, 0, 0, <%= parseFloat(banner_mask_alpha) %>)">
<div class="banner-text text-center fade-in-up">
Expand Down
1 change: 1 addition & 0 deletions layout/about.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ page.layout = "about"
page.title = theme.about.title || __('about.title')
page.subtitle = theme.about.subtitle || __('about.subtitle')
page.banner_img = page.banner_img || theme.about.banner_img
page.banner_img_center = page.banner_img_center || theme.about.banner_img_center
page.banner_img_height = page.banner_img_height || theme.about.banner_img_height
page.banner_mask_alpha = page.banner_mask_alpha || theme.about.banner_mask_alpha
%>
Expand Down
1 change: 1 addition & 0 deletions layout/archive.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ page.layout = "archive"
page.title = theme.archive.title || __('archive.title')
page.subtitle = theme.archive.subtitle || __('archive.subtitle')
page.banner_img = theme.archive.banner_img
page.banner_img_center = theme.archive.banner_img_center
page.banner_img_height = theme.archive.banner_img_height
page.banner_mask_alpha = theme.archive.banner_mask_alpha
%>
Expand Down
1 change: 1 addition & 0 deletions layout/categories.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ page.layout = 'categories'
page.title = theme.category.title || __('category.title')
page.subtitle = theme.category.subtitle || __('category.subtitle')
page.banner_img = theme.category.banner_img
page.banner_img_center = theme.category.banner_img_center
page.banner_img_height = theme.category.banner_img_height
page.banner_mask_alpha = theme.category.banner_mask_alpha
var orderBy = theme.category.order_by || 'name'
Expand Down
1 change: 1 addition & 0 deletions layout/category.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ page.layout = "category"
page.title = [__('category.title'), page.category].join(" - ")
page.subtitle = [__('category.subtitle'), page.category].join(" - ")
page.banner_img = theme.category.banner_img
page.banner_img_center = theme.category.banner_img_center
page.banner_img_height = theme.category.banner_img_height
page.banner_mask_alpha = theme.category.banner_mask_alpha

Expand Down
1 change: 1 addition & 0 deletions layout/links.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ page.layout = "links"
page.title = theme.links.title || __('links.title')
page.subtitle = theme.links.subtitle || __('links.subtitle')
page.banner_img = theme.links.banner_img
page.banner_img_center = theme.links.banner_img_center
page.banner_img_height = theme.links.banner_img_height
page.banner_mask_alpha = theme.links.banner_mask_alpha
page.comment = theme.links.comments.type
Expand Down
1 change: 1 addition & 0 deletions layout/page.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var layout = page.layout
page.title = page.title || __(`${ layout }.title`)
page.subtitle = page.subtitle || page.title || __(`${ layout }.subtitle`)
page.banner_img = page.banner_img || theme.page.banner_img
page.banner_img_center = page.banner_img_center || theme.page.banner_img_center
page.banner_img_height = page.banner_img_height || theme.page.banner_img_height
page.banner_mask_alpha = page.banner_mask_alpha || theme.page.banner_mask_alpha
%>
Expand Down
1 change: 1 addition & 0 deletions layout/post.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%
page.banner_img = page.banner_img || theme.post.banner_img
page.banner_img_center = page.banner_img_center || theme.post.banner_img_center
page.banner_img_height = page.banner_img_height || theme.post.banner_img_height
page.banner_mask_alpha = page.banner_mask_alpha || theme.post.banner_mask_alpha
%>
Expand Down
1 change: 1 addition & 0 deletions layout/tag.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ page.layout = "tag"
page.title = [__('tag.title'), page.tag].join(" - ")
page.subtitle = [__('tag.subtitle'), page.tag].join(" - ")
page.banner_img = theme.tag.banner_img
page.banner_img_center = theme.tag.banner_img_center
page.banner_img_height = theme.tag.banner_img_height
page.banner_mask_alpha = theme.tag.banner_mask_alpha

Expand Down
1 change: 1 addition & 0 deletions layout/tags.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ page.layout = "tags"
page.title = theme.tag.title || __('tag.title')
page.subtitle = theme.tag.subtitle || __('tag.subtitle')
page.banner_img = theme.tag.banner_img
page.banner_img_center = theme.tag.banner_img_center
page.banner_img_height = theme.tag.banner_img_height
page.banner_mask_alpha = theme.tag.banner_mask_alpha

Expand Down
Loading