HexoMac优雅使用指南

OS X如何搭建Hexo+github 静态博客

2016-06-03  本文已影响694人  MaxZing

整体步骤先写一下

1.安装Node.js(已安装请忽略)

 npm -version

会有版本号显示

2. 安装Git(已安装请忽略)

建议图形化安装,蛋不疼不要折腾 MacPorts安装法
图形化的 Git 安装工具:https://sourceforge.net/projects/git-osx-installer/

安装完成

3. 安装Hexo及其插件

很简单,打开终端
建议使用阿里的Node源,15分钟跟官方同步一次,速度杠杠的!
使用方法

#这两步,可以忽略
npm --registry=https://registry.npm.taobao.org install koa
npm --registry=https://registry.npm.taobao.org install cnpm -g

运行完之后执行安装操作
也可以直接安装,可能大陆会比较慢

cd ~/Document
# 创建目录
mkdir hexo
# 切换目录
cd hexo
# 安装 Hexo 输入密码
sudo npm install -g hexo-cli
# 初始化 Hexo
hexo init

**切换阿里的源后sudo npm install -g hexo-cli可以换成sudo cnpm install -g hexo-cli

npm install hexo-generator-index --save
npm install hexo-generator-archive --save
npm install hexo-generator-category --save
npm install hexo-generator-tag --save
npm install hexo-server --save
npm install hexo-deployer-git --save
npm install hexo-deployer-heroku --save
npm install hexo-deployer-rsync --save
npm install hexo-deployer-openshift --save
npm install hexo-renderer-marked --save
npm install hexo-renderer-stylus --save
npm install hexo-generator-feed --save
npm install hexo-generator-sitemap --save

嫌慢,用cnpm 代替npm

4. 部署到Github

这一步跟我之前写的CentOS下搭建Hexo + github 博客的部署到github一毛一样,可以参考参考。
这里只总结一下步骤

  • 配置git整体环境,已经配置过可忽略

如果全部完成的话,可以通过 http://github用户名.github.io访问你的博客

5. 配置Hexo主题

git clone https://github.com/iissnan/hexo-theme-next themes/next

并在目录hexo下的_config.yml中

# 找到 theme: 修改后面的参数,默认是 landscape
theme: next
上一篇下一篇

猜你喜欢

热点阅读