Hexo安装笔记

Hexo是一个基于nodejs的静态博客搭建框架,使用Markdown语法进行写作,然后生成静态网页,
部署生成的静态文件到服务器即可接受访问。

Hexo依赖于nodejsgit

安装过程

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上。

猜你喜欢

转载自www.cnblogs.com/yoqc/p/10722617.html