By
coney
更新日期:
Mac下hexo从入门到精通
之前玩blog的时候接触到了hexo,到现在也告一段落了,总结一下吧。
hexo到底是什么的介绍就懒得讲了。我的环境是Mac下,所以
需要安装什么
git
Mac下自带git,所以,不用安装了2333333
好吧,既然你诚心诚意的发问了。那我就稍微讲一下。
如何安装git
首先先装一个Homebrew,打开终端。
1
| ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
|
等安装完了,还差一条指令。
node.js
你可以直接去下载安装包。node.js;
或者直接用brew也是可以哒。
或者自先安装nvm。
1 2
| git clone git://github.com/creationix/nvm.git ~/nvm echo ". ~/.nvm/nvm.sh" >> ~/.bash_profile
|
关掉终端,重新打开,输入:
1 2 3
| nvm install v0.10.33 nvm use v0.10.33 nvm alias default v0.10.33
|
后面的那个v0.10.33就是node.js的版本,目前v0.10.33是最新的。
hexo
这一步得先安装好node.js。
需要先配什么
注册github/gitcafe/code.io
什么都行,总之只要提供免费主页托管的就会用起来萌萌哒。
然后,我用的是github。
生成SSH KEY
1
| ssh-keygen -t rsa -C "your_email@example.com"
|
然后将SSH KEY添加到github
登录到GitHub页面,右上角Account Settings->
SSH Public Keys->
Add another key->
将生成的key(id_rsa.pub文件)内容copy到输入框中->
save。
这个时候你在本地终端中,可以输入:
这个时候出来一堆东西,你只要看到successful这个单词就可以确定连接成功了。
然后设置个人信息。
1 2
| git config --global user.name "orifake" git config --global user.email timyjykaka@gmail.com
|
然后需要创建一个项目
在自己github主页右上角,创建一个新的repository。比如账号是myname,那么应该创建的repository的名字应该是myname.github.io。
配完了要干什么
然后更新_config.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| title: Orifake's blog #站点名,站点banner中 subtitle: Step by step #副标题 description: orifake's Blog|hexo|javascript #给搜索引擎看的,对站点的描述,可以自定义 author: orifake email: timyjykaka@gmail.com language: zh-CN url: / root: / permalink: :year/:month/:day/:title/ tag_dir: tags archive_dir: archives category_dir: categories new_post_name: :title.md default_layout: post auto_spacing: false titlecase: false max_open_file: 100 filename_case: 0 highlight: enable: true backtick_code_block: true line_number: true tab_replace: default_category: uncategorized category_map: tag_map: archive: 1 category: 1 tag: 1 port: 4000 logger: false logger_format: date_format: MMM D YYYY time_format: H:mm:ss per_page: 10 pagination_dir: page disqus_shortname: theme: coney exclude_generator: deploy: type: github repository: https://github.com/myname/myname.github.io.git branch: master
|
下面
就push上去了。