记录一下今天搭建博客的过程吧!
hexo是基于node的静态博客,需要安装node、git
hexo指令具体使用可查看:https://hexo.io/zh-cn/docs/commands
终端下:
cnpm install -g hexo -cli
cd blog/
(目录下生成了blog文件夹,后面的命令都是在blog文件夹下面进行的)
hexo init
hexo server
hexo new 文章名字
dir 查看目录下的文件夹
cd source/_posts/
dir
(可以看到_posts下生成了文章的markdown文件,编辑并保存文件)
cd ../..
(退回到blog文件夹下)
hexo generator
hexo server
(hexo s 也可以)
打开 locahost:4000可以看到博客主页
部署到github上
在github上创建 New repository,设置Repository name,最好是设置成github名字.github.io.git
然后修改blog下的_config.yml文件,将文件最后设置
deploy:
type: git
repo: https://github.com/用户名/用户名.github.io.git
branch: master
终端设置命令:hexo d
最后会提示输入github用户名及密码,输入正确后即可在github 上看到
输入https://tickticktock(你的用户名).github.io即可进入博客主页了
更改博客主题。。。
yilia主题:
https://github.com/litten/hexo-theme-yilia
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
更改_config.yml中的theme,
theme: yilia
最后
hexo clean
hexo g
hexo s
hexo d
(重新推到git上)
刷新自己的博客,就能看到新的主题了
样式以后自己再慢慢琢磨吧