27 Commits
v1.0 ... v1.3

Author SHA1 Message Date
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
shenyu
8498c48374 fix: README.md 2019-12-29 10:57:24 +08:00
shenyu
91abd96dce fix: style 2019-12-28 21:07:01 +08:00
shenyu
baa5a1cdc7 fix: style 2019-12-25 23:31:54 +08:00
shenyu
5d0cf6f1da fix: README.md 2019-12-25 23:27:30 +08:00
shenyu
0cccbcc7e0 feat: stylint 2019-12-25 21:43:56 +08:00
shenyu
3e8987666d fix 2019-12-25 21:31:38 +08:00
shenyu
b0626bfc24 feat: .travis.yml 2019-12-25 21:22:01 +08:00
shenyu
bb21bce8bf fix: README.md 2019-12-25 21:01:24 +08:00
shenyu
60fdc61f67 fix: README.md 2019-12-25 20:49:21 +08:00
26 changed files with 326 additions and 70 deletions

10
.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
.DS_Store
.idea/
*.log
*.iml
yarn.lock
package-lock.json
node_modules/
# Setting
_config.yml

45
.stylintrc Normal file
View File

@@ -0,0 +1,45 @@
{
"blocks": false,
"brackets": "never",
"colons": false,
"colors": "never",
"commaSpace": false,
"commentSpace": "never",
"cssLiteral": "never",
"customProperties": [],
"depthLimit": false,
"duplicates": false,
"efficient": false,
"exclude": [],
"extendPref": false,
"globalDupe": false,
"groupOutputByFile": false,
"indentPref": false,
"leadingZero": "never",
"maxErrors": false,
"maxWarnings": false,
"mixed": false,
"mixins": [],
"namingConvention": "lowercase-dash",
"namingConventionStrict": false,
"none": "never",
"noImportant": false,
"parenSpace": false,
"placeholders": "always",
"prefixVarsWithDollar": "always",
"quotePref": false,
"reporterOptions": {
"columns": ["lineData", "severity", "description", "rule"],
"columnSplitter": " ",
"showHeaders": false,
"truncate": false
},
"semicolons": "never",
"sortOrder": "never",
"stackedProperties": false,
"trailingWhitespace": "never",
"universal": false,
"valid": false,
"zeroUnits": "never",
"zIndexNormalize": false
}

8
.travis.yml Normal file
View File

@@ -0,0 +1,8 @@
language: node_js
node_js: node
cache:
npm: true
install: npm install

119
README.md
View File

@@ -1,10 +1,35 @@
<h1 align="center">Ayer</h1>
<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>
<p align="center">
<a href="https://travis-ci.org/Shen-Yu/hexo-theme-ayer?branch=master" target="_blank" rel="noopener noreferrer">
<img alt="travis-ci" src="https://travis-ci.org/Shen-Yu/hexo-theme-ayer.svg?branch=master">
</a>
<a href="http://standardjs.com" target="_blank" rel="noopener noreferrer">
<img alt="js-standard-style" src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg">
</a>
<a href="https://gitter.im/hexo-theme-ayer/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge" target="_blank" rel="noopener noreferrer">
<img alt="Gitter" src="https://badges.gitter.im/Join%20Chat.svg">
</a>
<br>
<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.2-blue.svg">
</a>
<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">
<img alt="hexo" src="https://img.shields.io/badge/hexo-%3E%3D3.0-blue.svg">
</a>
<img alt="platform" src="https://img.shields.io/badge/platform-PC--ios--android-cc2e8b.svg">
</p>
---
:ocean: Ayer is a clean and elegant theme for Hexo, also fast, powerful and responsive. It contains many awesome features, It's perfect for your blog, "Ayer" means "water" in Malaysian and "yesterday" in Spanish. If you have any queries or advice during the process of using, Please contact me!
收藏本主题请点右上角Star谢谢~
<b>收藏本主题请点右上角Star谢谢~</b>
### [Preview](https://shen-yu.gitee.io)
### [Preview 预览](https://shen-yu.gitee.io)
### [中文说明](https://shen-yu.gitee.io/2019/ayer/)
@@ -33,10 +58,10 @@ git pull
### Configuration
let me know if you cant find something.
let me know if you cant find anything.
``` yml
# Menu-侧边栏菜单
# Menu-Sidebar
menu:
Home: /
Archives: /archives
@@ -44,66 +69,72 @@ menu:
Travel: /tags/旅行/
About: /2019/about
# 网站图标和侧边栏logo
# Favicon and sidebar logo
favicon: /favicon.ico
logo: /images/ayer-side.svg
# 封面配置
# enable-是否启用封面path-封面背景图logo-封面logo
# Cover Setting
# enable: [true|false]path: [background-image]logo: [cover-logo-image]
cover:
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
# 页面顶部进度条
# ProgressBar
progressBar: ture
# 文章配置
# 文章太长,截断按钮文字(在需要截断的行增加此标记<!--more-->)
# Article Setting
# (Use this to excerpt if article is too long<!--more-->)
excerpt_link: Read More...
# 文章分享文字
# share text
share_text: Share
# 搜索文字
# search text
search_text: Search
# 分页文字
# nav text
nav_text:
page_prev: Prev page
page_next: Next page
post_prev: Newer posts
post_next: Older posts
# 文章页是否显示目录
# Catalog in article
toc: true
# 打赏
# 打赏type设定0-关闭打赏; 1-文章对应的md文件里有reward:true属性才有打赏 2-所有文章均有打赏
# 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
# type0-close reward 1-only open in article which you have configured reward:true 2-open in all articles
reward_type: 2
# 打赏wording
reward_wording: '请我喝杯咖啡吧~'
# 支付宝二维码图片地址跟你设置logo的方式一样。比如/images/alipay.jpg
# reward word
reward_wording: 'Buy me a cup of coffee~'
# qrcode image path
alipay: /images/alipay.jpg
# 微信二维码图片地址
# qrcode image path
weixin: /images/wechat.jpg
# 是否启用搜索
# Search
search: true
# RSS订阅(先安装hexo-generator-feed插件再去博客根目录config进行配置)
# RSS
rss: /atom.xml
# 评论1、Valine(推荐)2、Gitalk
# Comment1、Valine (recommended)2、Gitalk
# 1、Valine[一款快速、简洁且高效的无后端评论系统](https://github.com/xCss/Valine)
# 启用Valine必须先创建leancloud应用 获取 id|key 填入即可
# 1、Valine [A fast, simple & powerful comment system](https://github.com/xCss/Valine)
# You need create leancloud account first (https://console.leancloud.app), then put the id|key in below.
leancloud:
enable: true
app_id: #
app_key: #
# Valine配置
# Valine Setting
valine:
enable: true # 是否启用
avatar: mp # 头像样式(https://valine.js.org/avatar.html)
placeholder: 给我的文章加点评论吧~ # placeholder
enable: true
avatar: mp # (https://valine.js.org/avatar.html)
placeholder: Add some comments to my article~ # placeholder
# 2、Gitalk(https://github.com/gitalk/gitalk)
gitalk:
@@ -116,44 +147,44 @@ gitalk:
# GitHub Ribbons(https://github.blog/2008-12-19-github-ribbons/)
github:
# (关闭请设置为false)
# (Set false if you don't need)
url: https://github.com/Shen-Yu/hexo-theme-ayer
# fancybox(仅用于相册展示若需要可配置albums)
# fancybox(Use for gallery, set false if you don't need)
fancybox: true
# 访问量统计(不蒜子)
# pv&uv statistics
busuanzi:
enable: true
# 友盟cnzz统计(url填js代码src链接)
# cnzz statistics
cnzz:
enable: true
url: #
# Google Analytics
google_analytics: ''
# 百度统计
# Baidu Analytics
baidu_analytics: ''
# 数学公式
# mathjax
mathjax: true
# 网站成立年份(默认为 2019若填入年份小于当前年份则显示为 2018-2019 类似的格式)
# since year
since: 2019
#是否显示页脚信息(建议保留,有助于本主题的推广)
# pageFooter (Set true can let more people know this theme, Thanks!)
pageFooter: true
```
### 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
$ 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
# Hexo-generator-search
@@ -163,13 +194,13 @@ pageFooter: true
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
$ 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
feed:
@@ -183,7 +214,7 @@ pageFooter: true
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
$ npm uninstall hexo-generator-index --save

View File

@@ -36,6 +36,14 @@ nav_text:
# 文章页是否显示目录
toc: 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-所有文章均有打赏
reward_type: 2

View File

@@ -19,6 +19,10 @@
positionFixedSelector: '.tocbot',
positionFixedClass: 'is-position-fixed',
fixedSidebarOffset: 'auto',
onClick: (e) => {
document.getElementById(e.target.innerText).scrollIntoView()
return false;
}
});
</script>
<% } %>

View File

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

View File

@@ -12,6 +12,9 @@
<div class="article-meta">
<%- partial('post/date', {class_name: 'article-date', date_format: null}) %>
<%- partial('post/category') %>
<% if(theme.word_count && theme.word_count.enable && !post.no_word_count){%>
<%- partial('post/word') %>
<% } %>
</div>
<% } %>
@@ -31,7 +34,7 @@
<%- 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>
@@ -49,7 +52,7 @@
<%- partial('post/nav') %>
<% } %>
<% if (theme.valine && theme.valine.enable){ %>
<% if (theme.valine && theme.valine.enable && !post.no_valine){ %>
<%- partial('post/valine', {
key: post.slug,
title: post.title,

View File

@@ -25,7 +25,7 @@
</div>
</div>
<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>
</section>
<% } %>

View File

@@ -8,9 +8,10 @@
</li>
<li>
<% if (theme.pageFooter){ %>
Powered by
<% 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>'; %>
<%- hexoLink %> Theme <%- themeLink %> by shenyu
<%- hexoLink %> Theme <%- themeLink %>
<% } %>
</li>
</ul>

View File

@@ -23,8 +23,8 @@
<% if (theme.favicon){ %>
<link rel="shortcut icon" href="<%- theme.favicon %>" />
<% } %>
<%- css('css/style') %> <% if (theme.fancybox){ %> <%-
css('fancybox/jquery.fancybox.min') %> <% } %> <%- js('/js/pace.min.js') %>
<%- css('css/style') %>
<%- js('/js/pace.min.js') %>
<%- partial('google-analytics') %>
<%- partial('baidu-analytics') %>

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>
<% } %>

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -3,10 +3,12 @@
"version": "1.0.0",
"description": "ayer 是一个轻量优雅的 Hexo 主题",
"main": "index.js",
"dependencies": {},
"dependencies": {
"stylint": "^2.0.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "stylint source/css/style.styl -c .stylintrc"
},
"keywords": [
"ayer",

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

@@ -34,8 +34,7 @@ $base-style
acronym, abbr
border-bottom border-width border-color dotted
ul, ol, dl
margin 1.5rem 0
line-height line-height
margin 1.5rem 0 1.5rem 2rem
p, table, blockquote
margin 1.5rem 0

View File

@@ -53,7 +53,7 @@
.article-entry
font-size 110%
margin-top 1rem
margin-top .5rem
clearfix()
@extend $base-style
color body-color

View File

@@ -71,6 +71,12 @@
z-index 9998
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 (max-width: 768px)
.cover-inner

View File

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

View File

@@ -7,6 +7,7 @@
> .tag-list-item
display inline-block
padding .5rem 1rem
font-size 120%
&:before
content "\eec3"
font-family remixicon

View File

@@ -137,11 +137,11 @@
margins: 5
});
//
// scroll down
$(document).ready(function ($) {
$('.anchor').click(function (event) {
event.preventDefault();
$('main').animate({ scrollTop: $(this.hash).offset().top }, 'smooth');
$('.anchor').click(function (e) {
e.preventDefault();
$('main').animate({ scrollTop: $('.cover').height() }, 'smooth');
});
});