wororo.

hexoBlog

2017/09/09

Creating a GithubPage Blog with Hexo

Github Pages

  • Github Web: Create repo called username.github.io, where username is your username.

In my case: https://github.com/gabrieldelaparra/gabrieldelaparra.github.io

  • Github Web: Create another (private) repo called hexoBlog, where your hexo blog will be stored.

In my case: https://github.com/gabrieldelaparra/hexoBlog

Install Hexo

1
$ npm install -g hexo-cli

Create Blog

1
2
3
$ hexo init hexoBlog
$ cd hexoBlog
$ npm install

Test Server

1
$ hexo server

Set User Information

1
$ vi _config.yml

_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
# Site
title: wororo
subtitle: wororo.
description: proyectos, ideas, tecnología, ocio
author: Gabriel De La Parra
language: en
timezone: America/Santiago
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://gabrieldelaparra.github.io
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
# Writing
new_post_name: :year-:month-:day-:title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: true
relative_link: false
future: true
highlight:
enable: true
line_number: true
auto_detect: false
tab_replace:

Connect to git

1
2
3
4
5
$ git init
$ git remote add origin https://github.com/gabrieldelaparra/hexoBlog.git
$ git add .
$ git commit -m "Empty Hexo Blog"
$ git push -u origin master

Themes

Archer

1
2
3
$ cd hexoBlog
$ npm install hexo-generator-json-content --save
$ git clone https://github.com/fi3ework/hexo-theme-archer.git themes/archer

_config.yml:

1
2
3
4
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: archer

themes/archer/_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
# ========== Profile ========== #
avatar: /avatar/me.jpg
author: gabrieldelaparra
signature: wororo
social:
email: ignacio.delaparra@gmail.com
github: //github.com/gabrieldelaparra
twitter: //twitter.com/gabeldelaostia
# facebook:
# instagram:
# stack-overflow:
# linkedin:
# others:
# rss: /atom.xml
about:
enable: false
image: '/intro/about-page.jpg'
# ========== Site ========== #
SEO_title: wororo
main_title: wororo.
subtitle: proyectos, ideas, tecnología, ocio
site_header_image: '/intro/back1.jpg'
post_header_image: '/intro/back1.jpg'
_404_image: '/intro/404.jpg'
show_dates:

Help!

I’m not sure how to properly handle the following:

The archer theme is another git repo inside my hexoBlog repo (submodule, maybe, but). I want to be able to save my themes/archer/_config.yml to my repository. This for the case where I want to clone my own repository in another computer, or plain backup.

If I just do a git clone archer, and then delete the .git folder, then the files will be added to my repo, but then, I will not get any updates to the theme if the owner adds new features.

I think that I could do a fork and then merge changes manually in the future. I’m not sure how submodules work right now.

Any suggestions?

Deployment to Git

1
2
$ npm install hexo-deployer-git --save
$ vi _config.yml

_config.yml:

1
2
3
4
5
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/gabrieldelaparra/gabrieldelaparra.github.io

Adding new Posts and Deploying

Create Post

1
2
3
4
$ hexo new postName
INFO Created: ~/blog/source/_posts/YYYY-MM-dd-postName.md
$ code source/_posts/YYYY-MM-dd-postName.md

Deploy

1
2
$ hexo clean
$ hexo deploy -g
CATALOG
  1. 1. Creating a GithubPage Blog with Hexo
    1. 1.1. Github Pages
  2. 2. Install Hexo
    1. 2.1. Create Blog
    2. 2.2. Test Server
    3. 2.3. Set User Information
    4. 2.4. Connect to git
    5. 2.5. Themes
      1. 2.5.1. Archer
      2. 2.5.2. Help!
    6. 2.6. Deployment to Git
  3. 3. Adding new Posts and Deploying
    1. 3.1. Create Post
    2. 3.2. Deploy