使用hexo和github pages搭建我的博客

1. 建立Github 域名和空间

1.1注册

注册一个Github帐号html

1.2 建立仓库

记住Respository name 中的username.github.io 的username 必定与前面的Owner 一致。git

2. 安装

  1. 安装Gitgithub

  1. 安装Nodejnpm

  1. 安装Hexo(时间可能有点长,不要急)
    以上全部都安装完成以后再安装Hexo
    $ sudo npm install hexo-cli -g

3. 编写,发布

  建立博客
  $ hexo init username.github.io浏览器

  更改配置hexo

  主题安装工具

  为了使博客不太难看,咱们须要安装一个主题,切换至刚刚生成的Hexo 目录,安装主题post

  $ cd username.github.io测试

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

  基础配置:打开文件位置username.github.io/_config.yml修改几个键值对, 注意配置的键值之间必定要有空格。更多设置...

  title: 沐雪的小小世界    //你博客的名字

  author: 沐雪  //你的名字

  language: zh-Hans //语言 中文

  theme: next //刚刚安装的主题名称

  deploy:

  type: git //使用Git 发布

  repo: https://github.com/username/username.github.io.git

  主题配置:

  主题配置文件在username.github.io/themes/next/_config.yml中修改,这里略过。

  写文章

  在username.github.io/source/_posts下建立一个名为FirstBlog.md的文件,随便写点,好比“Hello World”。

  测试

  $ hexo s

  测试服务启动,在浏览器中输入https://localhost:4000 就能够访问了。

  安装hexo-deployer-git自动部署发布工具

  $ npm install hexo-deployer-git --save

  发布

  $ hexo clean 

  $hexo g

  $hexo d

 

其余的就看官方文档吧

相关文章
相关标签/搜索