Hexo是一个基于nodejs
的静态博客搭建框架,使用Markdown
语法进行写作,然后生成静态网页,
部署生成的静态文件到服务器即可接受访问。
Hexo依赖于nodejs
和git
。
安装过程
npm install -g hexo-cli
# 新建一个文件夹,用来建立博客
hexo init <folder>
cd <folder>
# 安装基本依赖
npm install
写作
# 创建新文章,默认有三种模板:draft,post和page。默认是post
hexo new <template> 'title'
# 把draft发布成post
hexo publish 'draft-title'
发布和部署
本机查看博客:
# 通过localhost访问博客
hexo server
# 生成和删除public文件夹
hexo generate
hexo clean
部署到Github/Bitbucket Static Pages
# 先安装依赖的包
npm install hexo-deployer-git
然后在_config.yml
里进行配置:
deploy:
type: git
repo: https://[username]@bitbucket.org/[username]/[username].bitbucket.io
name: [username]
email: [email]
最后执行hexo deploy
即可部署到Github/Bitbucket上。