perf(config): optimize base_info.logo settings

This commit is contained in:
XPoet 2022-09-23 14:51:16 +08:00
parent 2d80c45ec5
commit 49e0e1212f
3 changed files with 19 additions and 6 deletions

View File

@ -2,11 +2,19 @@
# Your basic info
# ---------------------------------------------------------------------------------------
base_info:
# Your website title
title: Keep Theme
# Your blog author name
author: Keep Team
# Your website url
url: https://keep.xpoet.cn/
# Logo image (You can use local image, image external link or dont fill)
logo_img:
# Your website logo image
# You can use local image, image external link or dont fill
logo: /images/logo.svg
# ---------------------------------------------------------------------------------------
# Theme style settings

View File

@ -1,14 +1,19 @@
<header class="header-wrapper">
<%
const { title, logo, logo_img } = theme.base_info
const { title: configTitle } = config
%>
<div class="header-content<%- (theme.style.first_screen.enable === true && is_home() && !page.prev) ? ' has-first-screen' : '' %>">
<div class="left">
<% if (theme.base_info.hasOwnProperty('logo_img') && theme.base_info.logo_img) { %>
<% if (logo || logo_img) { %>
<a class="logo-image" href="/">
<%- image_tag(theme.base_info.logo_img) %>
<%- image_tag(logo || logo_img) %>
</a>
<% } %>
<a class="logo-title" href="/">
<%= theme.base_info.title || config.title || 'Keep Theme' %>
<%= title || configTitle || 'Keep Theme' %>
</a>
</div>

View File

@ -50,7 +50,7 @@ $logo-image-box-width = 46px;
}
if (hexo-config('base_info.logo_img') && hexo-config('base_info.logo_img') != '') {
if (hexo-config('base_info.logo_img') || hexo-config('base_info.logo')) {
.logo-image {
width: $logo-image-box-width;
height: $logo-image-box-width;