Build Hexo

动手搭建基于Hexo的Blog

基本操作

依赖

安装hexo

1
2
3
mkdir <github-name>.github.io -p
cd <github-name>.github.io
sudo npm install -g hexo-cli

初始化博客框架

1
2
hexo init
npm install

初次展现

经过上面简单的步骤,已经把基本的博客框架给搭建好了.可以查看下效果.

1
hexo s

然后输入 localhost:4000可以查看下基本的效果.
不过,这不是我想要的.

美化操作

主题选择

下载主题到themes

1
git clone https://github.com/iissnan/hexo-theme-next themes/next

这样就把主题搞定了.不过要配置下.在<github-name.github.io>_config.yml中找到theme.

1
theme: next #注意, 默认是landscape

这里可配置文件选项较多,请查看文档

更多配置

提交到git

1
2
3
git push origin master
hexo g
hexo d

注意事项

git pushgithub page之后出现404.邮件反馈:

  • First
    1
    2
    3
    4
    5
    6
    7
    8
    9
    The page build completed successfully, but returned the following warning for the `master` branch:
    You are attempting to use a Jekyll theme, "next", which is not supported by GitHub Pages. Please visit https://pages.github.com/themes/ for a list of supported themes. If you are using the "theme" configuration variable for something other than a Jekyll theme, we recommend you rename this variable throughout your site. For more information, see https://help.github.com/articles/adding-a-jekyll-theme-to-your-github-pages-site/.
    For information on troubleshooting Jekyll see:
    https://help.github.com/articles/troubleshooting-jekyll-builds
    If you have any questions you can contact us by replying to this email.

这个是要指定下, 可以参考.

  • Second
1
2
3
4
5
6
7
8
9
The page build failed for the `master` branch with the following error:
The tag `fancybox` on line 77 in `themes/landscape/README.md` is not a recognized Liquid tag. For more information, see https://help.github.com/articles/page-build-failed-unknown-tag-error/.
For information on troubleshooting Jekyll see:
https://help.github.com/articles/troubleshooting-jekyll-builds
If you have any questions you can contact us by replying to this email.

这个也比较好解决的.去themes下的landscape删除README.md文件.