自从看到了hexo这个能在github上部署blog的东西就喜欢的一塌糊涂,各种上谷歌,百度找资料,花了7-8天时间搞了起来,天天写blog的日子真的蛮好了,每天不写的什么就仿佛缺了点什么似的痒痒的不行。在这里分享一下这么多多天碰到的一些坎和一些翻过坎之后的经验。话不多说,先上些环境参数:
- hexo版本
1 | $ hexo -v |
使用的NexT版本 NexT on github
1
2# Theme version
version: 6.0.4安装的npm module,使用flickr的原因是图都上传在flickr上,不想用国内的图床。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35$ cat package.json
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.6.0"
},
"dependencies": {
"gulp": "^3.9.1",
"gulp-htmlclean": "^2.7.20",
"gulp-htmlmin": "^4.0.0",
"gulp-minify-css": "^1.2.4",
"hexo": "^3.6.0",
"hexo-deployer-git": "^0.3.1",
"hexo-filter-github-emojis": "^1.4.4",
"hexo-footnotes": "^1.0.2",
"hexo-generator-archive": "^0.1.4",
"hexo-generator-category": "^0.1.3",
"hexo-generator-feed": "^1.2.2",
"hexo-generator-index-pin-top": "^0.2.2",
"hexo-generator-json-content": "^3.0.1",
"hexo-generator-searchdb": "^1.0.8",
"hexo-generator-sitemap": "^1.2.0",
"hexo-generator-tag": "^0.2.0",
"hexo-renderer-ejs": "^0.3.0",
"hexo-renderer-marked": "^0.3.0",
"hexo-renderer-stylus": "^0.3.1",
"hexo-server": "^0.2.0",
"hexo-tag-aplayer": "^2.0.7",
"hexo-tag-dplayer": "^0.3.1",
"hexo-tag-flickr-extended": "0.0.3",
"hexo-wordcount": "^3.0.2"
}
}同时上传至github和coding,修改文件blog主目录下的配置文件
1
2
3
4
5
6
7
8# Deployment
# Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo:
github: git@github.com:YOURNAME/YOURRES.github.io.git
coding: git@git.coding.net:YOURNAME/YOURRES.git
branch: master修改和NexT theme的config.yml和layout中的footer.swig,加入coding的链接然后审核一下就可以去掉自定义页面中会出现的跳转页面。
1
2
3
4
5
6# 修改footer.swig的最后定义custom_text的地方,去掉原有的注释。
{% if theme.footer.custom_text %}
<div class="footer-custom">
{{ theme.footer.custom_text }}{#
}</div>
{% endif %}针对主题配置文件的修改网络上现存的都是直接修改footer.swig,我试过只修改这个配置文件对新版本的theme没用,后来看主题配置文件的时候看到了人家已经写好了这么一行,把注释去掉特别方便。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#修改NexT主题目录下的配置文件,打开custom text的选项。
#我这边只关闭了powerd和theme版本的说明,嫌麻烦。。。。
$ vim themes/next/_config.yml
footer:
# Specify the date when the site was setup.
# If not defined, current year will be used.
since: 2018
# Icon between year and copyright info.
icon: chess-knight
# If not defined, will be used `author` from Hexo main config.
copyright:
# -------------------------------------------------------------
# Hexo link (Powered by Hexo).
powered: false
theme:
# Theme & scheme info link (Theme - NexT.scheme).
enable: false
# Version info of NexT after scheme info (vX.X.X).
version: false
# -------------------------------------------------------------
# Any custom text can be defined here.
custom_text: Hosted by <a target="_blank" rel="external nofollow" href="https://pages.coding.me"><b>Coding Pages</b></a>