From fdcff4bccd73664eae0237fabc7726d17110efc9 Mon Sep 17 00:00:00 2001 From: XPoet Date: Mon, 7 Dec 2020 14:36:53 +0800 Subject: [PATCH] feat: add first screen background image configuration in _config.yml --- _config.yml | 7 ++++--- source/css/layout/_partial/first-screen.styl | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/_config.yml b/_config.yml index 5141d95..01f6a46 100644 --- a/_config.yml +++ b/_config.yml @@ -15,10 +15,10 @@ style: primary_color: '#0066CC' # 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: images/logo.svg + favicon: /images/logo.svg # Image align position, value: left | center img_position: left @@ -37,7 +37,8 @@ style: # First screen first_screen: enable: true - description: Welcome to use Hexo theme Keep + background_img: /images/bg.svg + description: Keep writing and Keep loving. # --------------------------------------------------------------------------------------- diff --git a/source/css/layout/_partial/first-screen.styl b/source/css/layout/_partial/first-screen.styl index 9a37f93..c8f0ab6 100644 --- a/source/css/layout/_partial/first-screen.styl +++ b/source/css/layout/_partial/first-screen.styl @@ -1,12 +1,15 @@ $first-screen-font-size = 2rem; $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 { position: relative; box-sizing: border-box; width: 100%; overflow: hidden; - background: url("/images/bg.svg") center center / cover no-repeat; + background: url($first-screen-img) center center / cover no-repeat; .content { position: relative;