用hexo建博客碰到的问题总结
此文总结了本人用hexo建博客时碰到的一些问题
hexo常用命令
1 | hexo n #写文章 |
问题汇总
问题一:执行hexo d总报错
本机执行环境:hexo -v1
2
3
4
5
6
7
8
9
10hexo: 3.1.1
os: Windows_NT 10.0.10240 win32 x64
http_parser: 2.5.0
node: 4.1.0
v8: 4.5.103.33
uv: 1.7.4
zlib: 1.2.8
ares: 1.10.1-DEV
modules: 46
openssl: 1.0.2d
部署配置为1
2
3
4
5deploy:
type: git
#repo: https://github.com/Chiva-Zhao/jobar.github.io.git
repo: git@github.com:Chiva-Zhao/chiva-zhao.github.io.git
branch: master
执行hexo d报错:1
2
3
4
5
6
7
8
9
10
11
12
13
14nothing to commit, working directory clean
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
at ChildProcess.<anonymous> (D:\workspace\blog\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:42:17)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:817:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
分析
:本机装了git
和TortoiseGit
,执行deploy时候跟环境变量指定的TortoiseGit
有冲突,干掉相关的环境变量:”SVN_SSH” or “SSH”等含有TortoiseGit.exe
的环境变量
问题而:部署上去之后访问不了,github报404错误
分析
:github要求你必须要用username.github.io
来命名你的scheme。刚开始建的xxx.github.io是不能用的,必须要用你github的username
来建,了解了原因之后就好说了,重新改名为我的username.github.io.搞定!
具体参考这里
问题三:配置关于菜单
- 在博客主目录的source下建about目录
- 新建一个index.md文件输入内容
1
2
3# 关于我
爱生活,爱编程
问题四:RSS订阅不起作用
安装hexo-generator-feed插件
1
npm install hexo-generator-feed --save
执行
hexo g & hexo s
,发现public文件夹下已生成atom.xml
,搞定!
问题五:中英文以及中文乱码问题
需要把你编辑的博客文件保存为UTF-8的格式
另外在_config.yml文件中配置language选项language: zh-CN
问题六:如何配置分类和标签?
- 在博客主目录的source下新建
categories
和tags
目录,里面分别放一个index.md文件 - 内容分别为
1
2
3
4
5layout: categories
title: categories
layout: tags
title: tags
在写博客的时候前面文章前面加入:tags: [hexo,RSS, github]
多个标签用[]
括起来,,
做为分隔符categories:issues
hexo会为我们自动进行文章的分类和标签