42 Commits
v1.1 ... v1.7

Author SHA1 Message Date
shenyu
da20d7b3c9 feat: Subtitle typed animation 2020-01-30 14:14:35 +08:00
shenyu
7fcdbf8722 fix: tocbot 2020-01-29 20:36:48 +08:00
shenyu
71e1c2149d fix: style 2020-01-25 12:42:48 +08:00
shenyu
e528545051 release: v1.6 2020-01-24 13:06:25 +08:00
shenyu
3908fbe0e5 feat: valine comment verify 2020-01-24 13:02:50 +08:00
shenyu
db78e3261e fix: sidebar width 2020-01-23 14:19:50 +08:00
shenyu
8f267514b3 fix: sidebar 2020-01-23 14:13:24 +08:00
shenyu
0fb41a4ce2 fix: README.md 2020-01-23 11:30:35 +08:00
shenyu
dd35431d98 docs: images in article support click to fullscreen 2020-01-20 21:02:13 +08:00
沈宇
3d85b0926a feat: Support image display fullscreen 2020-01-20 15:09:23 +08:00
shenyu
661902f0f4 Merge branch 'master' of https://github.com/Shen-Yu/hexo-theme-ayer 2020-01-18 22:14:24 +08:00
shenyu
ef3c7271ef fix: style 2020-01-18 22:13:43 +08:00
沈宇
ad5e15c0e0 docs: fix license 2020-01-15 10:25:12 +08:00
沈宇
459860c16a docs: v1.5 2020-01-15 10:11:33 +08:00
沈宇
8c7a957f6e Create LICENSE 2020-01-15 08:35:30 +08:00
shenyu
7d408946e9 fix: docs 2020-01-15 08:25:50 +08:00
shenyu
df2f61aad0 fix: style 2020-01-15 07:57:43 +08:00
shenyu
bffec8c8d9 fix: style 2020-01-13 22:02:19 +08:00
shenyu
380d4c6501 Merge branch 'master' of https://github.com/Shen-Yu/hexo-theme-ayer 2020-01-13 21:36:53 +08:00
shenyu
8f93d6494e fix: sponsor.jpg 2020-01-13 21:36:32 +08:00
沈宇
f610f83e09 Create FUNDING.yml 2020-01-13 21:30:21 +08:00
shenyu
9dcd4aca7c feat: sponsor 2020-01-13 21:25:44 +08:00
shenyu
77ecc930bd style: Categories,Tags 2020-01-13 20:58:07 +08:00
shenyu
54216601f2 release: v1.3 2020-01-09 21:32:48 +08:00
shenyu
a38c874bb4 feat: close reward and comments in md 2020-01-09 20:26:44 +08:00
shenyu
63497f1ad2 fix:arrow jump&styles 2020-01-09 19:55:59 +08:00
shenyu
42b387c94a fix: wordcount style 2020-01-07 20:13:38 +08:00
shenyu
11a4aaacf2 feat: WordCount 2020-01-07 19:44:35 +08:00
沈宇
ca99e5de86 feat: WordCount 2020-01-07 14:05:02 +08:00
沈宇
758b378e82 fix: change anchor jump to scrollIntoView 2020-01-07 13:12:44 +08:00
沈宇
a8b0534861 Update _extend.styl 2020-01-06 13:19:29 +08:00
shenyu
246cae5164 fix: footer.ejs 2020-01-02 19:35:23 +08:00
shenyu
4e57d75cb9 fix 2019-12-31 22:59:03 +08:00
shenyu
faef444acd fix: README.md 2019-12-31 22:53:01 +08:00
shenyu
38131011fc fix: README.md 2019-12-31 22:48:55 +08:00
shenyu
4367d51759 release: v1.2 2019-12-30 22:01:38 +08:00
shenyu
ffb7bcb2d9 fix: style 2019-12-30 22:00:24 +08:00
shenyu
feb9fe196e fix: markdown style 2019-12-30 21:47:25 +08:00
shenyu
f1c03a8f21 fix: markdown list style 2019-12-30 21:23:12 +08:00
shenyu
0bc4b48060 fix: README.md 2019-12-30 20:22:40 +08:00
shenyu
1dbbc6110f fix: footer 2019-12-29 16:44:12 +08:00
shenyu
c90f268255 release: v1.1 2019-12-29 11:02:30 +08:00
32 changed files with 520 additions and 107 deletions

12
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://pic.downk.cc/item/5e1c70bc2fb38b8c3c5b0a2f.png

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 沈宇
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,6 +1,6 @@
<p align="center"><a href="https://shen-yu.gitee.io" target="_blank" rel="noopener noreferrer"><img width="100" src="logo.png" alt="ayer logo"></a></p> <p align="center"><a href="https://shen-yu.gitee.io" target="_blank" rel="noopener noreferrer"><img width="100" src="logo.png" alt="ayer logo"></a></p>
<h3 align="center">一个干净且优雅的 Hexo 主题</h3> <h3 align="center">一个安静且优雅的 Hexo 主题</h3>
<p align="center"> <p align="center">
<a href="https://travis-ci.org/Shen-Yu/hexo-theme-ayer?branch=master" target="_blank" rel="noopener noreferrer"> <a href="https://travis-ci.org/Shen-Yu/hexo-theme-ayer?branch=master" target="_blank" rel="noopener noreferrer">
@@ -14,7 +14,7 @@
</a> </a>
<br> <br>
<a href="https://github.com/Shen-Yu/hexo-theme-ayer/releases" target="_blank" rel="noopener noreferrer"> <a href="https://github.com/Shen-Yu/hexo-theme-ayer/releases" target="_blank" rel="noopener noreferrer">
<img alt="GitHub release" src="https://img.shields.io/badge/release-v1.0-blue.svg"> <img alt="GitHub release" src="https://img.shields.io/badge/release-v1.7-blue.svg">
</a> </a>
<img alt="language" src="https://img.shields.io/badge/language-ejs--stylus-orange.svg"> <img alt="language" src="https://img.shields.io/badge/language-ejs--stylus-orange.svg">
<a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener noreferrer"> <a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener noreferrer">
@@ -33,6 +33,8 @@
### [中文说明](https://shen-yu.gitee.io/2019/ayer/) ### [中文说明](https://shen-yu.gitee.io/2019/ayer/)
### [国内镜像](https://gitee.com/shen-yu/hexo-theme-ayer)
![Screenshot](screenshots/hexo-theme-ayer.png) ![Screenshot](screenshots/hexo-theme-ayer.png)
### Install ### Install
@@ -58,26 +60,39 @@ git pull
### Configuration ### Configuration
let me know if you cant find something. let me know if you have any questions.
``` yml ``` yml
# Menu-Sidebar # Menu-Sidebar
menu: menu:
Home: / Home: /
Archives: /archives Archives: /archives
Categories: /categories
Tags: /tags
Gallery: http://shenyu-vip.lofter.com Gallery: http://shenyu-vip.lofter.com
Travel: /tags/旅行/ Travel: /tags/旅行/
About: /2019/about About: /2019/about
# Subtitle and Typing animation
# https://github.com/mattboldt/typed.js
subtitle:
enable: true
text: a clean and elegant theme
startDelay: 0
typeSpeed: 200
loop: true
backSpeed: 100
showCursor: true
# Favicon and sidebar logo # Favicon and sidebar logo
favicon: /favicon.ico favicon: /favicon.ico
logo: /images/ayer-side.svg logo: /images/ayer-side.svg
# Cover Setting # Cover Setting
# enable: [true|false]path: [background-image path]logo: [cover-logo path] # enable: [true|false]path: [background-image]logo: [cover-logo-image]
cover: cover:
enable: true enable: true
path: /images/cover1.jpg # images目录下附送多张美图可更换 path: /images/cover1.jpg # there are some beautiful cover images in Ayer's directory: /source/images, choose your favorite image to replace it.
logo: /images/ayer.svg logo: /images/ayer.svg
# ProgressBar # ProgressBar
@@ -100,11 +115,20 @@ nav_text:
# Catalog in article # Catalog in article
toc: true toc: true
# images in the article support click to fullscreen
image_viewer: true
# https://github.com/willin/hexo-wordcount
word_count:
enable: true
# only display in article page(not in index page)
only_article_visit: true
# Reward Setting # Reward Setting
# type0-close reward 1-only open in article which you have configured reward:true 2-open in all articles # type0-close reward 1-only open in article which you have configured reward:true 2-open in all articles
reward_type: 2 reward_type: 2
# reward word # reward word
reward_wording: '请我喝杯咖啡吧~' reward_wording: 'Buy me a cup of coffee~'
# qrcode image path # qrcode image path
alipay: /images/alipay.jpg alipay: /images/alipay.jpg
# qrcode image path # qrcode image path
@@ -113,7 +137,7 @@ weixin: /images/wechat.jpg
# Search # Search
search: true search: true
# RSS(npm i hexo-generator-feed) # RSS
rss: /atom.xml rss: /atom.xml
# Comment1、Valine (recommended)2、Gitalk # Comment1、Valine (recommended)2、Gitalk
@@ -127,8 +151,9 @@ leancloud:
# Valine Setting # Valine Setting
valine: valine:
enable: true enable: true
verify: false # comment verify
avatar: mp # (https://valine.js.org/avatar.html) avatar: mp # (https://valine.js.org/avatar.html)
placeholder: 给我的文章加点评论吧~ # placeholder placeholder: Add some comments to my article~ # placeholder
# 2、Gitalk(https://github.com/gitalk/gitalk) # 2、Gitalk(https://github.com/gitalk/gitalk)
gitalk: gitalk:
@@ -167,18 +192,18 @@ mathjax: true
# since year # since year
since: 2019 since: 2019
# pageFooter (Set true and let more people know this theme, Thanks!) # pageFooter (Set true can let more people know this theme, Thanks!)
pageFooter: true pageFooter: true
``` ```
### Plugins ### Plugins
+ [hexo-generator-search](https://github.com/wzpan/hexo-generator-search) Local search + [hexo-generator-search](https://github.com/wzpan/hexo-generator-search) (for Local Search)
```yml ```yml
$ npm install hexo-generator-searchdb --save $ npm install hexo-generator-searchdb --save
``` ```
Then add the plugin configuration for hexo's configuration file `_config.yml` (note: not the theme's configuration file): Then add the plugin configuration in hexo's configuration file `_config.yml` (note: not the theme's configuration file):
```yml ```yml
# Hexo-generator-search # Hexo-generator-search
@@ -188,16 +213,16 @@ pageFooter: true
format: html format: html
``` ```
+ [hexo-generate-feed](https://github.com/hexojs/hexo-generator-feed) RSS + [hexo-generate-feed](https://github.com/hexojs/hexo-generator-feed) (for RSS)
```yml ```yml
$ npm install hexo-generator-feed --save $ npm install hexo-generator-feed --save
``` ```
Then add the plugin configuration for hexo's configuration file `_config.yml` (note: not the theme's configuration file): Then add the plugin configuration in hexo's configuration file `_config.yml` (note: not the theme's configuration file):
```yml ```yml
feed: feed:m
type: atom type: atom
path: atom.xml path: atom.xml
limit: 20 limit: 20
@@ -208,26 +233,28 @@ pageFooter: true
order_by: -date order_by: -date
``` ```
+ [hexo-generator-index-pin-top](https://github.com/netcan/hexo-generator-index-pin-top) + [hexo-generator-index-pin-top](https://github.com/netcan/hexo-generator-index-pin-top) (for Sticky Post)
``` bash ``` bash
$ npm uninstall hexo-generator-index --save $ npm uninstall hexo-generator-index --save
$ npm install hexo-generator-index-pin-top --save $ npm install hexo-generator-index-pin-top --save
``` ```
### Categories
### Post poster ``` bash
hexo new page categories
```
Then paste following codes to file: _posts/categories/index.md
``` md ``` md
--- ---
title: Post name title: categories
type: categories
photos: [ layout: "categories"
["img_url"],
["img_url"]
]
--- ---
``` ```
### Tags
Same as categories.
### Gallery ### Gallery
Need to write in the head of the markdown, this is not a good way to write, I hope to get a better way to write on github. Need to write in the head of the markdown, this is not a good way to write, I hope to get a better way to write on github.
@@ -262,6 +289,5 @@ Use Tocbot to parse the title tags (h1~h6) in the content and insert the directo
--- ---
Inspired by [Ocean](https://github.com/zhwangart/hexo-theme-ocean) <br/>
<a src="https://github.com/Shen-Yu/hexo-theme-ayer">Ayer</a> by <a href="https://github.com/Shen-Yu">Eric-Shen</a> is licensed under <a rel="license" href="https://www.mit-license.org/">MIT</a>.
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Ayer</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://github.com/Shen-Yu/hexo-theme-ayer" property="cc:attributionName" rel="cc:attributionURL">Eric-Shen</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.

View File

@@ -1,12 +1,24 @@
# 侧边栏菜单 # 侧边栏菜单
menu: menu:
主页: / 主页: /
目录: /archives 归档: /archives
分类: /categories
标签: /tags 标签: /tags
旅行: /tags/旅行/ 旅行: /tags/旅行/
摄影: http://shenyu-vip.lofter.com 摄影: http://shenyu-vip.lofter.com
关于我: /2019/about 关于我: /2019/about
# 站点次标题和打字动效
# https://github.com/mattboldt/typed.js
subtitle:
enable: true # 是否开启动效
text: 面朝大海,春暖花开 # 显示的文字
startDelay: 0 # 延迟时间
typeSpeed: 200 # 打字速度
loop: true # 是否循环
backSpeed: 100 # 回退速度
showCursor: true # 是否显示光标
# 网站图标和侧边栏logo # 网站图标和侧边栏logo
favicon: /favicon.ico favicon: /favicon.ico
logo: /images/ayer-side.svg logo: /images/ayer-side.svg
@@ -36,6 +48,17 @@ nav_text:
# 文章页是否显示目录 # 文章页是否显示目录
toc: true toc: true
# 文章中的图片是否支持点击放大
image_viewer: true
# https://github.com/willin/hexo-wordcount
# 是否开启字数统计(关闭请设置enable为false)
# 也可以单独在md文件里Front-matter设置`no_word_count: true`属性,来自定义关闭字数统计
word_count:
enable: true
# 只在文章详情显示(不在首页显示)
only_article_visit: true
# 打赏 # 打赏
# 打赏type设定0-关闭打赏; 1-文章对应的md文件里有reward:true属性才有打赏 2-所有文章均有打赏 # 打赏type设定0-关闭打赏; 1-文章对应的md文件里有reward:true属性才有打赏 2-所有文章均有打赏
reward_type: 2 reward_type: 2
@@ -63,6 +86,7 @@ leancloud:
# Valine配置 # Valine配置
valine: valine:
enable: true # 是否启用 enable: true # 是否启用
verify: false # 是否启用防垃圾验证
avatar: mp # 头像样式(https://valine.js.org/avatar.html) avatar: mp # 头像样式(https://valine.js.org/avatar.html)
placeholder: 给我的文章加点评论吧~ # placeholder placeholder: 给我的文章加点评论吧~ # placeholder

View File

@@ -6,6 +6,20 @@
<%- js('fancybox/jquery.fancybox.min') %> <%- js('fancybox/jquery.fancybox.min') %>
<% } %> <% } %>
<% if (theme.subtitle.enable){ %>
<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.11/lib/typed.min.js"></script>
<script>
var typed = new Typed("#subtitle", {
strings: ['<%= theme.subtitle.text %>'],
startDelay: <%= theme.subtitle.startDelay %>,
typeSpeed: <%= theme.subtitle.typeSpeed %>,
loop: <%= theme.subtitle.loop %>,
backSpeed: <%= theme.subtitle.backSpeed %>,
showCursor: <%= theme.subtitle.showCursor %>
});
</script>
<% } %>
<% if (theme.toc && is_post()){ %> <% if (theme.toc && is_post()){ %>
<%- js('/js/tocbot.min') %> <%- js('/js/tocbot.min') %>
<script> <script>
@@ -16,9 +30,16 @@
headingSelector: 'h1, h2, h3, h4, h5, h6', headingSelector: 'h1, h2, h3, h4, h5, h6',
hasInnerContainers: true, hasInnerContainers: true,
scrollSmooth: true, scrollSmooth: true,
scrollContainer:'main',
positionFixedSelector: '.tocbot', positionFixedSelector: '.tocbot',
positionFixedClass: 'is-position-fixed', positionFixedClass: 'is-position-fixed',
fixedSidebarOffset: 'auto', fixedSidebarOffset: 'auto',
onClick: (e) => {
$('.toc-link').removeClass('is-active-link');
$(`a[href=${e.target.hash}]`).addClass('is-active-link');
$(e.target.hash).scrollIntoView();
return false;
}
}); });
</script> </script>
<% } %> <% } %>
@@ -34,10 +55,12 @@
<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<% if (theme.image_viewer){ %>
<%- partial('viewer') %>
<% } %>
<% if (theme.mathjax){ %> <% if (theme.mathjax){ %>
<%- partial('mathjax') %> <%- partial('mathjax') %>
<% } %> <% } %>
<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script> <script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>

View File

@@ -9,8 +9,9 @@
else title = __('archive_a'); else title = __('archive_a');
} }
%> %>
<% if (pagination !== 2){ %>
<h1 class="page-type-title"><%- title %></h1> <h1 class="page-type-title"><%- title %></h1>
<% } %>
<% if (pagination == 2){ %> <% if (pagination == 2){ %>
<% page.posts.each(function(post){ %> <% page.posts.each(function(post){ %>
<%- partial('article', {post: post, index: true}) %> <%- partial('article', {post: post, index: true}) %>

View File

@@ -12,6 +12,9 @@
<div class="article-meta"> <div class="article-meta">
<%- partial('post/date', {class_name: 'article-date', date_format: null}) %> <%- partial('post/date', {class_name: 'article-date', date_format: null}) %>
<%- partial('post/category') %> <%- partial('post/category') %>
<% if(theme.word_count && theme.word_count.enable && !post.no_word_count){%>
<%- partial('post/word') %>
<% } %>
</div> </div>
<% } %> <% } %>
@@ -31,7 +34,7 @@
<%- post.content %> <%- post.content %>
<% } %> <% } %>
<!-- 打赏 --> <!-- 打赏 -->
<% if ((theme.reward_type === 2 || (theme.reward_type === 1 && post.reward)) && !index){ %> <% if ((theme.reward_type === 2 || (theme.reward_type === 1 && post.reward)) && !index && !post.no_reward){ %>
<div id="reward-btn"> <div id="reward-btn">
打赏 打赏
</div> </div>
@@ -49,7 +52,7 @@
<%- partial('post/nav') %> <%- partial('post/nav') %>
<% } %> <% } %>
<% if (theme.valine && theme.valine.enable){ %> <% if (theme.valine && theme.valine.enable && !post.no_valine){ %>
<%- partial('post/valine', { <%- partial('post/valine', {
key: post.slug, key: post.slug,
title: post.title, title: post.title,

View File

@@ -12,7 +12,13 @@
</div> </div>
<div class="cover-inner text-center text-white"> <div class="cover-inner text-center text-white">
<h1><a href="<%- url_for() %>"><%= config.title %></a></h1> <h1><a href="<%- url_for() %>"><%= config.title %></a></h1>
<h2><%= config.subtitle %></h2> <div id="subtitle-box">
<% if (theme.subtitle.enable) { %>
<span id="subtitle"></span>
<% }else{ %>
<span id="subtitle"><%= theme.subtitle.text %></span>
<% } %>
</div>
<div> <div>
<% if (theme.cover.logo) { %> <% if (theme.cover.logo) { %>
<img <img
@@ -25,7 +31,7 @@
</div> </div>
</div> </div>
<div class="cover-learn-more"> <div class="cover-learn-more">
<a href="#main" class="anchor"><i class="ri-arrow-down-line"></i></a> <a href="javascript:void(0)" class="anchor"><i class="ri-arrow-down-line"></i></a>
</div> </div>
</section> </section>
<% } %> <% } %>

View File

@@ -8,9 +8,10 @@
</li> </li>
<li> <li>
<% if (theme.pageFooter){ %> <% if (theme.pageFooter){ %>
Powered by
<% var hexoLink = '<a href="https://hexo.io" target="_blank">Hexo</a>'; %> <% var hexoLink = '<a href="https://hexo.io" target="_blank">Hexo</a>'; %>
<% var themeLink = '<a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>'; %> <% var themeLink = '<a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>'; %>
<%- hexoLink %> Theme <%- themeLink %> by shenyu <%- hexoLink %> Theme <%- themeLink %>
<% } %> <% } %>
</li> </li>
</ul> </ul>

View File

@@ -10,7 +10,7 @@
new Valine({ new Valine({
el: '#vcomments', el: '#vcomments',
notify: false, notify: false,
verify: false, verify: '<%- theme.leancloud.verify %>',
app_id: '<%- theme.leancloud.app_id %>', app_id: '<%- theme.leancloud.app_id %>',
app_key: '<%- theme.leancloud.app_key %>', app_key: '<%- theme.leancloud.app_key %>',
path: window.location.pathname, path: window.location.pathname,

View File

@@ -0,0 +1,20 @@
<% if (!theme.word_count.only_article_visit || (!index && theme.word_count.only_article_visit)){ %>
<div class="word_count">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="ri-quill-pen-line"></i>
<span class="post-meta-item-text"> 字数统计:</span>
<span class="post-count"><%= wordcount(post.content) %>字</span>
</span>
</span>
<span class="post-time">
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
<i class="ri-book-open-line"></i>
<span class="post-meta-item-text"> 阅读时长≈</span>
<span class="post-count"><%= min2read(post.content) %>分钟</span>
</span>
</span>
</div>
<% } %>

106
layout/_partial/viewer.ejs Normal file
View File

@@ -0,0 +1,106 @@
<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<!-- Background of PhotoSwipe.
It's a separate element as animating opacity is faster than rgba(). -->
<div class="pswp__bg"></div>
<!-- Slides wrapper with overflow:hidden. -->
<div class="pswp__scroll-wrap">
<!-- Container that holds slides.
PhotoSwipe keeps only 3 of them in the DOM to save memory.
Don't modify these 3 pswp__item elements, data is added later on. -->
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<!-- Controls are self-explanatory. Order can be changed. -->
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
<!-- element will get class pswp__preloader--active when preloader is running -->
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip"></div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
</button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
</button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>
<script>
function viewer_init() {
let pswpElement = document.querySelectorAll('.pswp')[0];
let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))
$imgArr.forEach(($em, i) => {
$em.onclick = () => {
// slider展开状态
// todo: 这样不好,后面改成状态
if (document.querySelector('.left-col.show')) return
let items = []
$imgArr.forEach(($em2, i2) => {
let img = $em2.getAttribute('data-idx', i2)
let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
let title = $em2.getAttribute('alt')
// 获得原图尺寸
const image = new Image()
image.src = src
items.push({
src: src,
w: image.width || $em2.width,
h: image.height || $em2.height,
title: title
})
})
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
index: parseInt(i)
});
gallery.init()
}
})
}
viewer_init()
</script>

View File

@@ -1,6 +1,17 @@
<section class="outer"> <section class="outer">
<% if (site.categories.length){ %> <% if (site.categories.length){ %>
<h1 class="page-type-title"><%= __('categories') %></h1> <h1 class="page-type-title"><%= __('categories') %></h1>
<%- list_categories({show_count: theme.show_count}) %> <!-- <%- list_categories({show_count: theme.show_count}) %> -->
<ul class="category-list">
<% site.categories.sort('name').each(function(item){ %>
<% if(item.posts.length){ %>
<a class="category-list-link" href="<%- config.root %><%- item.path %>" title="<%= item.name %>">
<li class="category-list-item">
<%= item.name %><i><%= item.posts.length %></i>
</li>
</a>
<% } %>
<% }); %>
</ul>
<% } %> <% } %>
</section> </section>

View File

@@ -9,11 +9,7 @@
<%- partial('_partial/totop') %> <%- partial('_partial/totop') %>
</div> </div>
</main> </main>
<% if (theme.toc && is_post()){ %>
<aside class="sidebar"> <aside class="sidebar">
<% } else { %>
<aside class="sidebar">
<% } %>
<%- partial('_partial/sidebar') %> <%- partial('_partial/sidebar') %>
</aside> </aside>
<%- partial('_partial/modal') %> <%- partial('_partial/modal') %>

View File

@@ -0,0 +1,8 @@
'use strict';
module.exports = {
// 生成meta `generator`
meta_generator: true
};

13
scripts/filters/index.js Normal file
View File

@@ -0,0 +1,13 @@
'use strict';
const metaGeneratorPath = './meta_generator';
module.exports = hexo => {
/* const {
filter
} = hexo.extend; */
// filter.register('after_render:html', require('./meta_generator'));
};
// 保持过滤器最先执行
hexo.extend.filter.register('after_render:html', require(metaGeneratorPath), 1);

View File

@@ -0,0 +1,17 @@
'use strict';
const defaultConfig = require('../default_config');
function hexoMetaGeneratorInject(data) {
const config = defaultConfig;
if (!config.meta_generator || !data ||
data.match(/<meta\s+name=['|"]?generator['|"]?/i)) {
return;
}
const hexoGeneratorTag = `\n <meta name="generator" content="hexo-theme-yilia-plus">`;
return data.replace('</title>', '</title>' + hexoGeneratorTag);
}
module.exports = hexoMetaGeneratorInject;

View File

@@ -0,0 +1,9 @@
/* global hexo */
'use strict';
/** 自定义链接生成 */
hexo.extend.helper.register('ayer_plus_vendors', function (url) {
if (url.startsWith('//')) return url;
return this.url_for(`${url}`);
});

View File

@@ -0,0 +1,39 @@
var util = require('hexo-util');
var stripHTML = util.stripHTML;
var counter = function (content) {
content = stripHTML(content);
const cn = (content.match(/[\u4E00-\u9FA5]/g) || []).length;
const en = (content.replace(/[\u4E00-\u9FA5]/g, '').match(/[a-zA-Z0-9_\u0392-\u03c9\u0400-\u04FF]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|[\u00E4\u00C4\u00E5\u00C5\u00F6\u00D6]+|\w+/g) || []).length;
return [cn, en];
};
hexo.extend.helper.register('min2read', function (content, {
cn = 300,
en = 160
} = {}) {
var len = counter(content);
var readingTime = len[0] / cn + len[1] / en;
return readingTime < 1 ? '1' : parseInt(readingTime, 10);
});
hexo.extend.helper.register('wordcount', function (content) {
var len = counter(content);
var count = len[0] + len[1];
if (count < 1000) {
return count;
}
return Math.round(count / 100) / 10 + 'k';
});
hexo.extend.helper.register('totalcount', function (site) {
var count = 0;
site.posts.forEach(function (post) {
var len = counter(post.content);
count += len[0] + len[1];
});
if (count < 1000) {
return count;
}
return Math.round(count / 100) / 10 + 'k';
});

25
scripts/lib/core.js Normal file
View File

@@ -0,0 +1,25 @@
/* global hexo */
'use strict';
// Hexo事件:https://hexo.io/zh-cn/api/events
/** 在静态文件生成前发布 */
hexo.on('generateBefore', () => {
// Merge config.
//require('./../filters/index')(hexo);
});
/** 在文章文件建立后发布。该事件返回文章参数。 */
hexo.on('new', function (post) {
//console.log(post)
});
/** 在文章开始渲染前执行 */
hexo.extend.filter.register('before_post_render', function (data) {
//var config = hexo.config;
//console.log(3);
//console.log(config);
//console.log(hexo.theme.config);
});

View File

@@ -9,7 +9,7 @@ $block
$base-style $base-style
h1, h2, h3, h4, h5, h6 h1, h2, h3, h4, h5, h6
margin 1.5rem 0 margin 2.5rem 0 1.5rem
hr hr
height border-width height border-width
background-color border-color background-color border-color
@@ -34,8 +34,7 @@ $base-style
acronym, abbr acronym, abbr
border-bottom border-width border-color dotted border-bottom border-width border-color dotted
ul, ol, dl ul, ol, dl
margin 1.5rem 0 margin 1.5rem 0 1.5rem 2rem
line-height line-height
p, table, blockquote p, table, blockquote
margin 1.5rem 0 margin 1.5rem 0

View File

@@ -46,7 +46,7 @@
padding-left 3rem padding-left 3rem
.archive-article-title .archive-article-title
text-decoration: none text-decoration: none
font-size 1.5rem font-size 1.8rem
.archive-article-footer .archive-article-footer
margin-top: 1.5rem margin-top: 1.5rem

View File

@@ -32,7 +32,7 @@
@extend $block-caption @extend $block-caption
&::before &::before
content '\eaf2' content '\eaf2'
margin-right .5rem margin-right .15rem
font-family remixicon font-family remixicon
opacity .5 opacity .5
@@ -42,7 +42,7 @@
&:before &:before
content "\efde" content "\efde"
font-family remixicon font-family remixicon
margin-right .5rem margin-right .15rem
opacity 0.6 opacity 0.6
.article-category-link .article-category-link
@extend $block-caption @extend $block-caption
@@ -53,7 +53,7 @@
.article-entry .article-entry
font-size 110% font-size 110%
margin-top 1rem margin-top .5rem
clearfix() clearfix()
@extend $base-style @extend $base-style
color body-color color body-color

View File

@@ -25,10 +25,12 @@
left 50% left 50%
transform translate(-50%, -100%) transform translate(-50%, -100%)
h1 h1
font-family: Titillium Web,PingFang SC,Hiragino Sans GB,"Microsoft JhengHei","Microsoft YaHei",Helvetica Neue,Helvetica,Arial,sans-serif
font-size 7rem font-size 7rem
margin 0 margin 0
opacity .95 opacity .95
h2 #subtitle-box
font-family: Titillium Web,PingFang SC,Hiragino Sans GB,"Microsoft JhengHei","Microsoft YaHei",Helvetica Neue,Helvetica,Arial,sans-serif
font-size 3rem font-size 3rem
margin .5rem 0 1.5rem margin .5rem 0 1.5rem
a, & a, &
@@ -71,6 +73,12 @@
z-index 9998 z-index 9998
display none display none
.word_count
margin-top 5px
color darken(gray,30%)
padding-bottom 1rem
border-bottom 1px solid darken(froth-light,2%)
// Media Query // Media Query
@media (max-width: 768px) @media (max-width: 768px)
.cover-inner .cover-inner
@@ -78,7 +86,7 @@
width 100% width 100%
h1 h1
font-size 4.5rem font-size 4.5rem
h2 #subtitle-box
font-size 2rem font-size 2rem
.to_top .to_top

View File

@@ -4,10 +4,41 @@
list-unstyled() list-unstyled()
margin-right -.5rem margin-right -.5rem
margin-left -.5rem margin-left -.5rem
> .category-list-item .category-list-item
display inline-block margin: 10px 10px;
padding .5rem 1rem padding: 0 14px;
display: inline-block;
text-align: center;
height: 38px;
min-width: 80px;
line-height: 38px;
font-size: 1.5rem;
font-weight: 500;
border-radius: 5px;
word-wrap: break-word;
cursor: pointer;
box-shadow: 0px 3px 5px rgba(0,0,0,0.08);
border: 1px solid #e7e7eb
&:before &:before
content "\efde" content "\efde"
font-family remixicon font-family remixicon
margin-right .5rem margin-right .5rem
display inline-block
vertical-align middle
i
font-style normal
margin-left 10px
color: darken(water,20%)
a
display inline-block
vertical-align middle
text-decoration: none
color: body-color
&:hover
.category-list-item
border: 1px solid darken(water,20%)
box-shadow: 0 3px 5px water
color: darken(water,30%);
&:before
color: darken(water,30%);

View File

@@ -1,7 +1,9 @@
highlight-background = #f6f8fa highlight-background = #2d2d2d
highlight-code = #f2f2f2
highlight-code-color = #c7254e
highlight-current-line = #efefef highlight-current-line = #efefef
highlight-selection = #d6d6d6 highlight-selection = #000
highlight-foreground = #4d4d4c highlight-foreground = #dedede
highlight-comment = #8e908c highlight-comment = #8e908c
highlight-red = #f2777a highlight-red = #f2777a
highlight-orange = #f99157 highlight-orange = #f99157
@@ -23,12 +25,15 @@ $line-numbers
color highlight-comment color highlight-comment
.article-entry .article-entry
ol>li>ul
padding-inline-start: 2rem;
pre, code pre, code
font-family inherit font-family inherit
text-shadow none text-shadow none
code code
background highlight-background color highlight-code-color
padding .25rem background highlight-code
padding .25rem .6rem
border-radius(.4rem) border-radius(.4rem)
pre pre
@extend $code-block @extend $code-block
@@ -146,3 +151,4 @@ pre
.keyword .keyword
.javascript .function .javascript .function
color highlight-purple color highlight-purple

View File

@@ -12,3 +12,21 @@
content "\eec3" content "\eec3"
font-family remixicon font-family remixicon
margin-right .5rem margin-right .5rem
display inline-block
vertical-align middle
color: tag-color
.tag-list-link
display inline-block
vertical-align middle
text-decoration: none
height 30px
line-height 30px
padding: 0 15px
font-size: 1.5rem
border-radius: 15px
background-color tag-color
color white
box-shadow: 0 3px 5px rgba(0,0,0,0.12)
transition: .2s
&:hover
transform: scale(1.1)

View File

@@ -1,6 +1,6 @@
.tocbot .tocbot
position fixed position absolute
top 14rem top 14rem
left calc((100vw - 70rem) / 2 + 70rem) left calc((100vw - 70rem) / 2 + 70rem)
font-size 80% font-size 80%
@@ -47,3 +47,9 @@ a.toc-link
margin-top -1px margin-top -1px
position absolute position absolute
width 2px width 2px
.is-active-link::before
background-color sea-blue
.is-active-link
font-weight 700

View File

@@ -51,7 +51,7 @@ border-width = 0.1rem
border-color = froth border-color = froth
// Layout // Layout
aside-width = 7rem aside-width = 8rem
wrap-width = 70rem wrap-width = 70rem
years-width = 6rem years-width = 6rem
logo-size = 4.2rem logo-size = 4.2rem

BIN
source/images/ayer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
source/images/sponsor.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@@ -137,11 +137,11 @@
margins: 5 margins: 5
}); });
// // scroll down
$(document).ready(function ($) { $(document).ready(function ($) {
$('.anchor').click(function (event) { $('.anchor').click(function (e) {
event.preventDefault(); e.preventDefault();
$('main').animate({ scrollTop: $(this.hash).offset().top }, 'smooth'); $('main').animate({ scrollTop: $('.cover').height() }, 'smooth');
}); });
}); });
@@ -176,30 +176,14 @@
// Mobile nav // Mobile nav
var $content = $('.content'), var $content = $('.content'),
$sidebar = $('.sidebar'), $sidebar = $('.sidebar');
isMobileNavAnim = false,
mobileNavAnimDuration = 200;
var startMobileNavAnim = function () {
isMobileNavAnim = true;
};
var stopMobileNavAnim = function () {
setTimeout(function () {
isMobileNavAnim = false;
}, mobileNavAnimDuration);
};
$('.navbar-toggle').on('click', function () { $('.navbar-toggle').on('click', function () {
if (isMobileNavAnim) return;
startMobileNavAnim();
$content.toggleClass('on'); $content.toggleClass('on');
$sidebar.toggleClass('on'); $sidebar.toggleClass('on');
stopMobileNavAnim();
}); });
$($content).on('click', function () { $($content).on('click', function () {
if (isMobileNavAnim || !$content.hasClass('on')) return;
$content.removeClass('on'); $content.removeClass('on');
$sidebar.removeClass('on'); $sidebar.removeClass('on');
}); });