hexo搭建博客

Hexo Usage


下载安装

  • 安装Node
    到Node.js官网下载相应平台的最新版本,一路安装即可。我用的是node-v0.10.22-x86.msi

  • 安装Git
    Git的客户端很多,我用的是msysgit,喜欢用绿色版本Portable application for official Git for Windows 1.8.4,下载下来设置一下环境变量即可,Git_HOME,%Git_HOME%\bin之类的,不多说。

github

  • 注册账号
  • 新建仓库
  • add shh公钥

hexo的安装和初始化

  • 安装 npm install -g hexo
  • 升级
  • 初始化 init
  • 生成网站 hexo generate
  • 服务器 hexo server
    服器会跑在 http://localhost:port (port 预设为 4000,可在 _config.yml 设定)

hexo的使用

写文章
  • 创建新博客 hexo new
  • 离线编辑文章属性
    title: postName #文章页面上的显示名称,可以任意修改,不会出现在URL中
    date: 2013-12-02 15:30:16 #文章生成时间,一般不改,当然也可以任意修改
    categories: default#文章分类目录,可以为空,注意:后面有个空格
    tags: [hexo]#文章标签,可空,多标签请用格式[tag1,tag2,tag3],注意:后面有个空格
    description: 你对本页的描述
属性
- - - 
这里开始使用markdown格式输入你的正文。
自定义主题

all of theme
pacman
modernist
ishgo

  • 安装主题
    git clone https://github.com/heroicyang/hexo-theme-modernist.git themes/modernist
    目录是否是modernist无所谓,只要与_config.yml文件一致即可。
    安装完成后,打开hexo_config.yml,修改主题为modernist
    theme: modernist
    打开hexo\themes\modernist目录,编辑主题配置文件_config.yml:
  • 更新主题
    cd themes/modernist
    git pull

域名申请

GitHubPages默认为每个用户分配了一个二级域名『your_user_name.github.com』或『your_user_name.github.io』。
如果你对上述域名不满意,可以到狗爹上申请一个自己的域名,然后绑定到GitHub Pages。绑定方法很简单,在repo根目录下建立一个CNAME文件,里面写上域名即可。

posted @ 2016-04-05 14:13  Taogen  阅读(185)  评论(0编辑  收藏  举报