pref: optimize theme config
This commit is contained in:
parent
f23ac2d795
commit
73ee16edce
90
_config.yml
90
_config.yml
|
@ -1,10 +1,16 @@
|
||||||
# theme basic info
|
# theme basic info
|
||||||
theme_info:
|
theme_info:
|
||||||
name: ILS
|
name: ILS
|
||||||
version: 1.0.2
|
version: 1.1.0
|
||||||
author: XPoet
|
author: XPoet
|
||||||
repository: https://github.com/XPoet/hexo-theme-ils
|
repository: https://github.com/XPoet/hexo-theme-ils
|
||||||
|
|
||||||
|
# favicon
|
||||||
|
favicon: images/favicon.png
|
||||||
|
|
||||||
|
# avatar
|
||||||
|
avatar: images/avatar.png
|
||||||
|
|
||||||
# navigation menu
|
# navigation menu
|
||||||
menu:
|
menu:
|
||||||
Home: /
|
Home: /
|
||||||
|
@ -17,22 +23,17 @@ menu:
|
||||||
rss:
|
rss:
|
||||||
enable: true
|
enable: true
|
||||||
|
|
||||||
# favicon
|
|
||||||
favicon: images/favicon.png
|
|
||||||
|
|
||||||
# comment plugin
|
# comment plugin
|
||||||
comments:
|
comments:
|
||||||
# Valine.
|
# Valine https://github.com/xCss/Valine
|
||||||
# more info please open https://github.com/xCss/Valine
|
|
||||||
valine:
|
valine:
|
||||||
enable: false # true or false
|
enable: false
|
||||||
appid: # your leancloud application appid
|
appid: # your leancloud application appid
|
||||||
appkey: # your leancloud application appkey
|
appkey: # your leancloud application appkey
|
||||||
meta: # type: Array, default: ['nick','mail','link']
|
meta: # comment input meta, type: Array, values: ['nick','mail','link']
|
||||||
placeholder: Please share your thoughts with us in the comments below! #your placeholder
|
placeholder: # your placeholder
|
||||||
|
|
||||||
# Gitalk
|
# Gitalk https://github.com/gitalk/gitalk
|
||||||
# For more information: https://gitalk.github.io, https://github.com/gitalk/gitalk
|
|
||||||
gitalk:
|
gitalk:
|
||||||
enable: false
|
enable: false
|
||||||
github_id: # GitHub repo owner
|
github_id: # GitHub repo owner
|
||||||
|
@ -41,60 +42,59 @@ comments:
|
||||||
client_secret: # GitHub Application Client Secret
|
client_secret: # GitHub Application Client Secret
|
||||||
distraction_free_mode: false # Facebook-like distraction free mode
|
distraction_free_mode: false # Facebook-like distraction free mode
|
||||||
|
|
||||||
# Show PV/UV of the website/page with busuanzi.
|
# website count
|
||||||
# Get more information on http://ibruce.info/2015/04/04/busuanzi/
|
website_count:
|
||||||
busuanzi_count:
|
# busuanzi http://ibruce.info/2015/04/04/busuanzi/
|
||||||
# count values only if the other configs are false
|
busuanzi_count:
|
||||||
enable: false
|
enable: false
|
||||||
# custom uv span for the whole site
|
|
||||||
site_uv: false
|
site_uv: false
|
||||||
# custom pv span for the whole site
|
|
||||||
site_pv: false
|
site_pv: false
|
||||||
# custom pv span for one page only
|
|
||||||
page_pv: false
|
page_pv: false
|
||||||
|
|
||||||
# Local Search
|
# Local Search
|
||||||
# Dependencies: https://github.com/theme-next/hexo-generator-searchdb
|
# Dependencies: https://github.com/theme-next/hexo-generator-searchdb
|
||||||
local_search:
|
local_search:
|
||||||
enable: false
|
enable: true
|
||||||
|
|
||||||
# If auto, trigger search by changing input.
|
# If auto, trigger search by changing input.
|
||||||
# If manual, trigger search by pressing enter key or search button.
|
# If manual, trigger search by pressing enter key or search button.
|
||||||
trigger: auto
|
trigger: auto # values: auto | manual
|
||||||
# Show top n results per article, show all results by setting to -1
|
|
||||||
top_n_per_article: 1
|
|
||||||
# Unescape html strings to the readable one.
|
# Unescape html strings to the readable one.
|
||||||
unescape: false
|
unescape: false
|
||||||
|
|
||||||
# Preload the search data when the page loads.
|
# Preload the search data when the page loads.
|
||||||
preload: false
|
preload: false
|
||||||
|
|
||||||
# Code Block
|
# Code Copy
|
||||||
codeblock:
|
code_copy:
|
||||||
style: flat # Available values: default | flat | mac
|
|
||||||
copy_button:
|
|
||||||
enable: true
|
enable: true
|
||||||
|
style: flat # values: default | flat | mac
|
||||||
# Table of Contents in the Sidebar
|
|
||||||
toc:
|
|
||||||
enable: true
|
|
||||||
# Automatically add list number to toc.
|
|
||||||
number: true
|
|
||||||
# If true, all level of TOC in a post will be displayed, rather than the activated part of it.
|
|
||||||
expand_all: true
|
|
||||||
|
|
||||||
# magic theme style
|
|
||||||
magic:
|
|
||||||
enable: true
|
|
||||||
sidebar:
|
|
||||||
enable: true
|
|
||||||
fixed: true
|
|
||||||
position: right
|
|
||||||
|
|
||||||
# sidebar tools
|
# sidebar tools
|
||||||
side-tools:
|
side_tools:
|
||||||
enable: true
|
enable: true
|
||||||
position: right
|
position: right # values: left | right
|
||||||
|
|
||||||
# back to top
|
# back to top
|
||||||
back2top:
|
back2top:
|
||||||
enable: true
|
enable: true
|
||||||
position: right
|
position: right # values: left | right
|
||||||
|
|
||||||
|
# Table of Contents in the Sidebar
|
||||||
|
toc:
|
||||||
|
enable: true
|
||||||
|
|
||||||
|
# Automatically add list number to toc.
|
||||||
|
number: true
|
||||||
|
|
||||||
|
# If true, all level of TOC in a post will be displayed, rather than the activated part of it.
|
||||||
|
expand_all: true
|
||||||
|
|
||||||
|
# magic theme
|
||||||
|
magic:
|
||||||
|
enable: true
|
||||||
|
sidebar:
|
||||||
|
enable: false
|
||||||
|
fixed: true
|
||||||
|
position: right # values: left | right
|
|
@ -26,7 +26,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</span>
|
</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (theme.busuanzi_count.enable && theme.busuanzi_count.page_pv && is_post()) { %>
|
<% if (theme.website_count.busuanzi_count.enable && theme.website_count.busuanzi_count.page_pv && is_post()) { %>
|
||||||
<span class="article-pv article-meta-item">
|
<span class="article-pv article-meta-item">
|
||||||
<i class="fa fa-eye"></i> <span id="busuanzi_value_page_pv"></span>
|
<i class="fa fa-eye"></i> <span id="busuanzi_value_page_pv"></span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
<%- __('powered_by', '<a target="_blank" href="https://hexo.io">Hexo</a>') %> | <%- __('theme') %> <a
|
<%- __('powered_by', '<a target="_blank" href="https://hexo.io">Hexo</a>') %> | <%- __('theme') %> <a
|
||||||
href="https://github.com/XPoet/hexo-theme-ils" target="_blank"><%= theme.theme_info.name %> v<%= theme.theme_info.version %></a>
|
href="https://github.com/XPoet/hexo-theme-ils" target="_blank"><%= theme.theme_info.name %> v<%= theme.theme_info.version %></a>
|
||||||
</div>
|
</div>
|
||||||
<% if (theme.busuanzi_count.enable) { %>
|
<% if (theme.website_count.busuanzi_count.enable) { %>
|
||||||
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
|
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
|
||||||
<div class="website-count info-item">
|
<div class="website-count info-item">
|
||||||
<% if (theme.busuanzi_count.site_uv) { %>
|
<% if (theme.website_count.busuanzi_count.site_uv) { %>
|
||||||
<span id="busuanzi_container_site_uv" style="display: none">
|
<span id="busuanzi_container_site_uv" style="display: none">
|
||||||
<%- __('site_uv') %><span id="busuanzi_value_site_uv"></span>
|
<%- __('site_uv') %><span id="busuanzi_value_site_uv"></span>
|
||||||
</span>
|
</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (theme.busuanzi_count.site_pv) { %>
|
<% if (theme.website_count.busuanzi_count.site_pv) { %>
|
||||||
<span id="busuanzi_container_site_pv" style="display: none">
|
<span id="busuanzi_container_site_pv" style="display: none">
|
||||||
<%- __('site_pv') %><span id="busuanzi_value_site_pv"></span>
|
<%- __('site_pv') %><span id="busuanzi_value_site_pv"></span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<% if (is_post()) { %>
|
<% if (is_post()) { %>
|
||||||
|
|
||||||
<% if (theme.codeblock.copy_button.enable) { %>
|
<% if (theme.code_copy.enable) { %>
|
||||||
<%- js('js/code-copy.js') %>
|
<%- js('js/code-copy.js') %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ if ((hexo-config('magic.enable') && !hexo-config('magic.sidebar.enable') && hexo
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: $header-height + $component-interspace;
|
top: $header-height + $component-interspace;
|
||||||
|
|
||||||
if (hexo-config('side-tools.position') == left) {
|
if (hexo-config('side_tools.position') == left) {
|
||||||
right: 30px;
|
right: 30px;
|
||||||
} else {
|
} else {
|
||||||
left: 30px;
|
left: 30px;
|
||||||
|
|
|
@ -28,13 +28,13 @@ disable-user-select() {
|
||||||
disable-user-select();
|
disable-user-select();
|
||||||
the-transition();
|
the-transition();
|
||||||
|
|
||||||
if (hexo-config('codeblock.style') == 'flat') {
|
if (hexo-config('code_copy.style') == 'flat') {
|
||||||
background: white;
|
background: white;
|
||||||
border: 0;
|
border: 0;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
} else if (hexo-config('codeblock.style') == 'mac') {
|
} else if (hexo-config('code_copy.style') == 'mac') {
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
right: 2px;
|
right: 2px;
|
||||||
|
@ -51,7 +51,7 @@ disable-user-select() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (hexo-config('codeblock.style') == 'mac') {
|
if (hexo-config('code_copy.style') == 'mac') {
|
||||||
.highlight-container {
|
.highlight-container {
|
||||||
background: #21252b;
|
background: #21252b;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// ==================================
|
// ===================================
|
||||||
// THEME VARIABLE
|
// THEME VARIABLE //
|
||||||
// ==================================
|
// ===================================
|
||||||
|
|
||||||
// ===============================
|
// ===================================
|
||||||
// layout
|
// layout
|
||||||
// ===============================
|
// ===================================
|
||||||
if (hexo-config('magic.enable')) {
|
if (hexo-config('magic.enable')) {
|
||||||
$header-height = 80px; // 头部默认高度
|
$header-height = 80px; // 头部默认高度
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,15 +22,15 @@ $header-shrink-height = 60px; // 头部收缩高度
|
||||||
$tool-button-width = 36px; // 方形工具按钮宽度
|
$tool-button-width = 36px; // 方形工具按钮宽度
|
||||||
$component-interspace = 30px; // 组件/模块的间隔值(px)
|
$component-interspace = 30px; // 组件/模块的间隔值(px)
|
||||||
|
|
||||||
// ===============================
|
// ===================================
|
||||||
// 媒体查询
|
// 媒体查询
|
||||||
// ===============================
|
// ===================================
|
||||||
$media-max-width = 760px; // 媒体查询最大宽度
|
$media-max-width = 760px; // 媒体查询最大宽度
|
||||||
|
|
||||||
|
|
||||||
// ===============================
|
// ===================================
|
||||||
// z-index
|
// z-index
|
||||||
// ===============================
|
// ===================================
|
||||||
$z-index-1 = 1001;
|
$z-index-1 = 1001;
|
||||||
$z-index-2 = 1002;
|
$z-index-2 = 1002;
|
||||||
$z-index-3 = 1003;
|
$z-index-3 = 1003;
|
||||||
|
@ -39,16 +39,16 @@ $z-index-5 = 1005;
|
||||||
$z-index-6 = 1006;
|
$z-index-6 = 1006;
|
||||||
|
|
||||||
|
|
||||||
// ===============================
|
// ===================================
|
||||||
// color
|
// color
|
||||||
// ===============================
|
// ===================================
|
||||||
// normal mode color
|
// normal mode color
|
||||||
$primary-color = #1b65ea; // 主题颜色
|
$primary-color = #225eea; // 主题颜色
|
||||||
$background-color = #fff; // 背景颜色
|
$background-color = #fff; // 背景颜色
|
||||||
$magic-background-color = #f5f5f5; // MAGIC 主题背景颜色
|
$magic-background-color = #f5f5f5; // MAGIC 主题背景颜色
|
||||||
$normal-text-color = #3c3944; // 通用文本颜色(默认字体颜色)
|
$normal-text-color = #43404d; // 通用文本颜色(默认字体颜色)
|
||||||
$first-text-color = darken($normal-text-color, 10%); // 第一文本颜色
|
$first-text-color = darken($normal-text-color, 8%); // 第一文本颜色
|
||||||
$second-text-color = darken($normal-text-color, 5%); // 第二文本颜色
|
$second-text-color = darken($normal-text-color, 4%); // 第二文本颜色
|
||||||
$third-text-color = lighten($normal-text-color, 40%); // 第三文本颜色
|
$third-text-color = lighten($normal-text-color, 40%); // 第三文本颜色
|
||||||
$fourth-text-color = #eee; // 第四文本颜色
|
$fourth-text-color = #eee; // 第四文本颜色
|
||||||
$border-color = darken($background-color, 30%); // 边框颜色
|
$border-color = darken($background-color, 30%); // 边框颜色
|
||||||
|
@ -67,9 +67,9 @@ $dark-border-color = lighten($dark-background-color, 20%);
|
||||||
$dark-selection-color = $selection-color;
|
$dark-selection-color = $selection-color;
|
||||||
|
|
||||||
|
|
||||||
// ===============================
|
// ===================================
|
||||||
// font
|
// font
|
||||||
// ===============================
|
// ===================================
|
||||||
//$default-font-family = 'PingHei', 'PingFang SC', 'Microsoft YaHei';
|
//$default-font-family = 'PingHei', 'PingFang SC', 'Microsoft YaHei';
|
||||||
//$default-font-family = 'PingFang SC', 'Hiragino Sans GB', 'STHeiti Light';
|
//$default-font-family = 'PingFang SC', 'Hiragino Sans GB', 'STHeiti Light';
|
||||||
//$default-font-family = 'Microsoft YaHei', 'SimHei', 'WenQuanYi Micro Hei', sans-serif;
|
//$default-font-family = 'Microsoft YaHei', 'SimHei', 'WenQuanYi Micro Hei', sans-serif;
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
.sidebar-tools {
|
.sidebar-tools {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: $header-height + $component-interspace;
|
top: $header-height + $component-interspace;
|
||||||
if (hexo-config('side-tools.position') == left) {
|
if (hexo-config('side_tools.position') == left) {
|
||||||
left: ((100% - $main-content-width) / 4);
|
left: ((100% - $main-content-width) / 4);
|
||||||
} else {
|
} else {
|
||||||
right: ((100% - $main-content-width) / 4);
|
right: ((100% - $main-content-width) / 4);
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-tools {
|
.sidebar-tools {
|
||||||
if (hexo-config('side-tools.position') == left) {
|
if (hexo-config('side_tools.position') == left) {
|
||||||
left: 2% !important;
|
left: 2% !important;
|
||||||
transform-origin: left top;
|
transform-origin: left top;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,7 +40,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
word = word.toLowerCase();
|
word = word.toLowerCase();
|
||||||
}
|
}
|
||||||
while ((position = text.indexOf(word, startPosition)) > -1) {
|
while ((position = text.indexOf(word, startPosition)) > -1) {
|
||||||
index.push({ position, word });
|
index.push({position, word});
|
||||||
startPosition = position + wordLen;
|
startPosition = position + wordLen;
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
|
@ -49,7 +49,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
// Merge hits into slices
|
// Merge hits into slices
|
||||||
const mergeIntoSlice = (start, end, index, searchText) => {
|
const mergeIntoSlice = (start, end, index, searchText) => {
|
||||||
let item = index[index.length - 1];
|
let item = index[index.length - 1];
|
||||||
let { position, word } = item;
|
let {position, word} = item;
|
||||||
let hits = [];
|
let hits = [];
|
||||||
let searchTextCountInSlice = 0;
|
let searchTextCountInSlice = 0;
|
||||||
while (position + word.length <= end && index.length !== 0) {
|
while (position + word.length <= end && index.length !== 0) {
|
||||||
|
@ -107,7 +107,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
let resultItems = [];
|
let resultItems = [];
|
||||||
if (searchText.length > 0) {
|
if (searchText.length > 0) {
|
||||||
// Perform local searching
|
// Perform local searching
|
||||||
datas.forEach(({ title, content, url }) => {
|
datas.forEach(({title, content, url}) => {
|
||||||
let titleInLowerCase = title.toLowerCase();
|
let titleInLowerCase = title.toLowerCase();
|
||||||
let contentInLowerCase = content.toLowerCase();
|
let contentInLowerCase = content.toLowerCase();
|
||||||
let indexOfTitle = [];
|
let indexOfTitle = [];
|
||||||
|
@ -141,7 +141,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
let slicesOfContent = [];
|
let slicesOfContent = [];
|
||||||
while (indexOfContent.length !== 0) {
|
while (indexOfContent.length !== 0) {
|
||||||
let item = indexOfContent[indexOfContent.length - 1];
|
let item = indexOfContent[indexOfContent.length - 1];
|
||||||
let { position, word } = item;
|
let {position, word} = item;
|
||||||
// Cut out 100 characters
|
// Cut out 100 characters
|
||||||
let start = position - 20;
|
let start = position - 20;
|
||||||
let end = position + 80;
|
let end = position + 80;
|
||||||
|
@ -170,7 +170,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Select top N slices in content
|
// Select top N slices in content
|
||||||
let upperBound = parseInt(CONFIG.localsearch.top_n_per_article, 10);
|
let upperBound = parseInt(CONFIG.localsearch.top_n_per_article ? CONFIG.localsearch.top_n_per_article : 1, 10);
|
||||||
if (upperBound >= 0) {
|
if (upperBound >= 0) {
|
||||||
slicesOfContent = slicesOfContent.slice(0, upperBound);
|
slicesOfContent = slicesOfContent.slice(0, upperBound);
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
resultItem += '</li>';
|
resultItem += '</li>';
|
||||||
resultItems.push({
|
resultItems.push({
|
||||||
item: resultItem,
|
item: resultItem,
|
||||||
id : resultItems.length,
|
id: resultItems.length,
|
||||||
hitCount,
|
hitCount,
|
||||||
searchTextCount
|
searchTextCount
|
||||||
});
|
});
|
||||||
|
@ -228,9 +228,9 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
isfetched = true;
|
isfetched = true;
|
||||||
datas = isXml ? [...new DOMParser().parseFromString(res, 'text/xml').querySelectorAll('entry')].map(element => {
|
datas = isXml ? [...new DOMParser().parseFromString(res, 'text/xml').querySelectorAll('entry')].map(element => {
|
||||||
return {
|
return {
|
||||||
title : element.querySelector('title').textContent,
|
title: element.querySelector('title').textContent,
|
||||||
content: element.querySelector('content').textContent,
|
content: element.querySelector('content').textContent,
|
||||||
url : element.querySelector('url').textContent
|
url: element.querySelector('url').textContent
|
||||||
};
|
};
|
||||||
}) : JSON.parse(res);
|
}) : JSON.parse(res);
|
||||||
// Only match articles with not empty titles
|
// Only match articles with not empty titles
|
||||||
|
|
Loading…
Reference in New Issue