refactor: adjust theme && theme user base info

This commit is contained in:
XPoet 2020-10-28 19:33:43 +08:00
parent a0f7170894
commit 7af399e98f
6 changed files with 25 additions and 13 deletions

View File

@ -1,12 +1,11 @@
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
# Theme basic info (please don't change) # Your basic info
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
theme_info: base_info:
name: ILS title: ILS
version: 2.1.1
author: XPoet author: XPoet
repository: https://github.com/XPoet/hexo-theme-ils email: i@xpoet.cn
url: https://ils.xpoet.cn/
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
# Theme style settings # Theme style settings

View File

@ -1,7 +1,7 @@
<footer class="footer"> <footer class="footer">
<div class="info-container"> <div class="info-container">
<div class="copyright-info info-item"> <div class="copyright-info info-item">
&copy; <%= date(new Date(), 'YYYY') %> <i class="fa fa-heart-o"></i> <a href="/"><%= config.author %></a> &copy; <%= date(new Date(), 'YYYY') %> <i class="fa fa-heart-o"></i> <a href="/"><%= theme.base_info.author || config.author || 'XPoet' %></a>
</div> </div>
<% if (theme.website_count.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>
@ -19,8 +19,7 @@
</div> </div>
<% } %> <% } %>
<div class="theme-info info-item"> <div class="theme-info info-item">
<%- __('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 class="theme-version" target="_blank"></a>
href="https://github.com/XPoet/hexo-theme-ils" target="_blank"><%= theme.theme_info.name %> v<%= theme.theme_info.version %></a>
</div> </div>
</div> </div>
</footer> </footer>

View File

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

View File

@ -3,7 +3,7 @@
<div class="header-content"> <div class="header-content">
<a class="logo-title" href="/"> <a class="logo-title" href="/">
<%= config.title %> <%= theme.base_info.title || config.title || 'ILS' %>
</a> </a>
<ul class="menu-list"> <ul class="menu-list">

View File

@ -13,7 +13,6 @@ hexo.extend.helper.register('export_config', function () {
hostname: url.parse(config.url).hostname || config.url, hostname: url.parse(config.url).hostname || config.url,
root: config.root, root: config.root,
localsearch: theme.local_search, localsearch: theme.local_search,
themeInfo: theme.theme_info,
codeblock: theme.codeblock, codeblock: theme.codeblock,
toc: theme.toc, toc: theme.toc,
back2top: theme.back2top back2top: theme.back2top

View File

@ -1,6 +1,21 @@
ILS.utils = { ILS.utils = {
themeInfo: {
author: 'XPoet',
name: 'ILS',
version: '2.1.2',
repository: 'https://github.com/XPoet/hexo-theme-ils'
},
printThemeInfo() { printThemeInfo() {
console.log(`${CONFIG.themeInfo.name} v${CONFIG.themeInfo.version}`); const themeInfo = `${this.themeInfo.name} v${this.themeInfo.version}`;
console.log(themeInfo);
const footThemeInfoDom = document.querySelector('.footer .info-container .theme-info a.theme-version');
if (footThemeInfoDom) {
footThemeInfoDom.setAttribute('href', this.themeInfo.repository);
footThemeInfoDom.innerHTML = themeInfo;
}
} }
} }