使用Hexo搭建博客
Quick Start
Create a new post
1 | $ hexo new "My New Post" |
More info: Writing
Run server
1 | $ hexo server |
More info: Server
Generate static files
1 | $ hexo generate |
或者
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
clean
小心使用清理命令,会把post目录下面的文件都清理掉
1 | hexo clean |
More info: Deployment
快捷命令:
测试:
1 | hexo g && hexo s |
发布:
1 | hexo g && hexo d |
安装主题
下载主题
下载主题到themes 目录下。有2种主流方式。
git clone
可以直接 clone 到 themes 目录下,优点是如果对主题有调整需求可以同时提交到 git 控制中。
1 | $ git clone https://github.com/olOwOlo/hugo-theme-even themes/even |
git submodule
也可以添加到 git 的 submodule 中,优点是后面讲到用 travis 自动部署时比较方便。如果需要对主题做更改,最好 fork 主题再做改动。
1 | $ git submodule add https://github.com/olOwOlo/hugo-theme-even.git themes/even |
配置安装
到根目录下找到配置文件_config.yml -> theme: landscape
theme: 主题key
landscape: 对应themes目录下的文件夹名