Hexo 블로그 프레임워크에 tranquilpeak Theme를 적용해서 블로그를 만들어보고 Markdown을 사용하여 포스팅 해보자.

Hexo 란?

Hexo is a fast, simple and powerful blog framework. You write posts in Markdown (or other languages) and Hexo generates static files with a beautiful theme in seconds.

Hexo 블로그 프레임워크 설치

설치환경

node v8.9.1
npm 5.5.1

repository 생성

1
<Username>.github.io

로컬에 생성한 repository를 clone 받는다.

1
2
$ git clone https://github.com/<Username>/<Username>.github.io.git
$ cd <Username>.github.io

Hexo 설치

1
$ npm install -g hexo-cli

folder 생성 초기화

1
2
3
$ hexo init <folder>
$ cd <folder>
$ npm install

blog 라는 폴더명으로 생성했다고 가정한다

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

tranquilpeak Theme 적용.

1
$ cd blog/themes

원하는 테마를 내려받는다. https://hexo.io/themes/

1
2
3
4
5
6
7
$ git clone https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak.git
$ mv hexo-theme-tranquilpeak tranquilpeak
$ cd tranquilpeak
$ npm install -g bower grunt-cli
$ npm install
$ bower install
$ grunt build

_config.yml 수정

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

Enable post assets folder, Enable RSS feed, Enable pages

Hexo configuration

빌드 후 로컬에서 확인해보기

1
2
3
$ hexo clean
$ hexo g
$ hexo server

http://localhost:4000

$ hexo g 빌드가 완료되면 public 폴더가 생성된다.
public 폴더 내의 파일을 배포하면 된다.

관리

draft 파일은 private 프로젝트로 올려두고,
tranquilpeak 는 fork 받아 필요한 부분만 수정하여 별도 프로젝트로 두었다.

로컬에서 draft 파일을 받아서 포스팅을 작성하고
hexo 빌드 후에 public 폴더내의 파일을 borakim-b.github.io 내에 copy 하는 스크립트 실행 후
두개의 프로젝트에 모두 code push 하는 형태

https://github.com/borakim-b/borakim-b.github.io
https://github.com/borakim-b/github-blog-draft
https://github.com/borakim-b/hexo-theme-tranquilpeak

포스트 쓰기

1
$ hexo new post <title>

배포 플러그인 설치 후 배포하는 방법

1
$ npm install hexo-deployer-git --save

_config.yml 파일에서 deploy 확인

1
2
3
4
5
6
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/<Username>/<Username>.github.io.git
branch: master

배포

1
$ hexo deploy