【hexo】搭建hexo博客
准备工作
github上创建仓库
用户名+ github.io
比如我的:HappyTeemo7569.github.io
安装环境
- git
- Node.js
https://nodejs.org/en/download/
- cmder(非必须) ,我是连同laragon一起安装的
安装hexo
npm install -g hexo-cli
hexo init blog
cd blog
hexo new test_my_site //创建测试文章
hexo g
hexo s
打开
localhost:4000
部署
配置文件
最下面编辑
deploy:
type: git
repo: https://github.com/HappyTeemo7569/HappyTeemo7569.github.io.git
branch: master
安装工具
npm install hexo-deployer-git --save
报错
这是warning错误,是因为mac下需要 fsevents,在windows或linux环境下,请忽略这个错误。
然后
hexo clean
hexo g
hexo d
看git历史,会有提交应该。
其实打包好的放在:
自己提交都可以。
小结
hexo命令
Commands:
clean Remove generated files and cache. 清理
config Get or set configurations.
deploy Deploy your website. 发布
generate Generate static files. 生成静态文件
help Get help on a command.
init Create a new Hexo folder. 初始化项目
list List the information of the site
migrate Migrate your site from other system to Hexo.
new Create a new post. 创建新文章
publish Moves a draft post from _drafts to _posts folder.
render Render files with renderer plugins.
server Start the server. 本地部署
version Display version information.
每次部署的步骤,可按以下三步来进行。
hexo clean
hexo g
hexo d
换主题
我喜欢的https://github.com/bujige/hexo-theme-yulia
3.1 安装
使用终端命令,切换到 hexo 博客的根目录,然后执行下面的命令
$ git clone https://github.com/bujige/hexo-theme-yulia.git themes/yulia
3.2 配置
修改 hexo 根目录下的 _config.yml : theme: yulia
3.3 更新
cd themes/yulia
git pull
OK
还没有评论,来说两句吧...