feat: add first screen background image configuration in _config.yml

This commit is contained in:
XPoet 2020-12-07 14:36:53 +08:00
parent 18c2a48601
commit fdcff4bccd
2 changed files with 8 additions and 4 deletions

View File

@ -15,10 +15,10 @@ style:
primary_color: '#0066CC' primary_color: '#0066CC'
# Avatar (You can use local image or image external link) # Avatar (You can use local image or image external link)
avatar: images/avatar.png avatar: /images/avatar.png
# Favicon (You can use local image or image external link) # Favicon (You can use local image or image external link)
favicon: images/logo.svg favicon: /images/logo.svg
# Image align position, value: left | center # Image align position, value: left | center
img_position: left img_position: left
@ -37,7 +37,8 @@ style:
# First screen # First screen
first_screen: first_screen:
enable: true enable: true
description: Welcome to use Hexo theme Keep background_img: /images/bg.svg
description: Keep writing and Keep loving.
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------

View File

@ -1,12 +1,15 @@
$first-screen-font-size = 2rem; $first-screen-font-size = 2rem;
$first-screen-icon-size = 1.6rem; $first-screen-icon-size = 1.6rem;
$temp-img = hexo-config('style.first_screen.background_img');
$first-screen-img = $temp-img ? $temp-img : '/images/bg.svg';
.first-screen-container { .first-screen-container {
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
background: url("/images/bg.svg") center center / cover no-repeat; background: url($first-screen-img) center center / cover no-repeat;
.content { .content {
position: relative; position: relative;