feat: add img_position and left_side_width in _config.yml

This commit is contained in:
XPoet 2020-11-17 10:50:55 +08:00
parent 1a240b0e28
commit 7318cae1bb
7 changed files with 18 additions and 10 deletions

View File

@ -23,9 +23,7 @@
<%= theme.base_info.title || config.title || 'ILS' %>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<% if (theme.style.favicon){ %>
<%- favicon_tag(theme.style.favicon) %>
<% } %>
<%- favicon_tag('images/favicon.png') %>
<%- css('css/style') %>
<%- export_config() %>
</head>

View File

@ -5,10 +5,10 @@
<span class="title-hover-animation"><%= page.title %></span>
</div>
<% if (theme.style.avatar && (theme.base_info.author || config.author)) { %>
<% if (theme.base_info.author || config.author) { %>
<div class="article-header">
<div class="avatar">
<%- image_tag(theme.style.avatar) %>
<%- image_tag('images/avatar.png') %>
</div>
<div class="info">
<div class="author">

View File

@ -16,7 +16,8 @@ hexo.extend.helper.register('export_config', function () {
codeblock: theme.codeblock,
toc: theme.toc,
back2top: theme.back2top,
side_tools: theme.side_tools
side_tools: theme.side_tools,
style: theme.style
};
if (config.search) {
exportConfig.path = config.search.path;

View File

@ -144,10 +144,17 @@
img {
box-sizing: initial;
padding: 2px;
margin: 2px 0;
max-width: 100%;
border: 1px solid var(--border-color);
cursor: pointer;
display: block;
if (hexo-config('style.img_position') == 'center') {
margin: 2px auto;
} else {
margin: 2px 0;
}
}
& > table {

View File

@ -49,7 +49,8 @@ $z-index-9 = 1009;
// color
// ========================================================================
// primary color
$primary-color = convert(hexo-config("style.primary_color")) || #0066CC;
$temp-color = hexo-config('style.primary_color');
$primary-color = $temp-color ? convert($temp-color) : #0066CC;
$background-color = #fff; // light background color
$second-background-color = darken($background-color, 2%); // second light background color
$normal-text-color = #383838; //

View File

@ -2,7 +2,8 @@
@require "./common/animated.styl";
$header-progress-height = 3px;
$page-aside-width = 258px;
$temp-width = hexo-config('style.left_side_width');
$page-aside-width = $temp-width ? convert($temp-width) : 260px;
.page-container {

View File

@ -30,7 +30,7 @@ window.addEventListener('DOMContentLoaded', () => {
},
changePageLayoutWhenOpenToggle(isOpen) {
const pageAsideWidth = '258px';
const pageAsideWidth = CONFIG.style.left_side_width || '260px';
this.containerDom.style.paddingLeft = isOpen ? pageAsideWidth : '0';
this.pageTopDom.style.paddingLeft = isOpen ? pageAsideWidth : '0';
this.leftAsideDom.style.left = isOpen ? '0' : `-${pageAsideWidth}`;