본문 바로가기

개발/hexo

hexo 설치

https://hexo.io/ko/ 링크

node 설치

hexo는 node가 필요하다. node가 없으면 여기를 클릭해 다운받아서 설치하면 된다.


hexo 설치

hexo는 아래 명령어를 사용하면 쉽게 설치할 수 있다.

$ npm install -g hexo-cli


hexo 초기화

hexo를 초기화 하기 위해서 아래 명령을 수행한다.

$ hexo init <folder>
$ cd <folder>
$ npm install


새 글 생성

새 글을 생성 하기 위해 아래 명령을 수행한다. "layout"은 default로 "post" 이다. 확인은 "_config.yml"에 정의된 default_layout를 확인하면 된다.


$ hexo new [layout] <title>


글 작성

새로 생긴 글은 [프로젝트 폴더]/source/_posts/[title].md에서 확인할 수 있다.

Markdown 문서로 작성하면 된다.

generate

정적 파일을 생성하기 위해 아래 명령을 수행한다.


$ hexo generate


server

server로 확인 할수 있다.

기본적으로 http://localhost:4000/를 사용한다.

git에 deploy하기

우선 hexo-deployer-git을 설치한다.


$ npm install hexo-deployer-git --save


_config.yml에 설정을 수정 한다.


deploy:
  type: git
  repo: <repository url="">


deploy를 한다.


$ hexo deploy


느낀점

메우 쉽게 블로그를 만들 수 있다. github 사용자면 자신의 아이디로 된 github.io 사이트에서 자신의 블로그를 만들어 운영할 수 있다.