Hexo에는 세가지 layout이 있다. post - source/_posts 위치에 저장, .md파일 형태 draft - source/_drafts 위치에 저장, .md파일 형태, post의 내용이 완성되지 않아서 사이트에 올리고 싶지 않을 때 임시저장 비슷한 기능 page - source 위치에 저장
Front-matter
게시물에 대한 환경 설정을 하는 영역 생성된 포스트의 최상단에 작성돼 있다.
title - 게시물의 제목
date - 게시물을 만든 시간
tags - 게시물에 관련된 태그
categories - 게시물 분류, 상위에 있는 분류가 대분류가 된다.
1
2
3
4
5
6
7
8
9
10
<!--현재 게시물의 Front-matter-->
title: Hexo Usage
date: 2017-05-03 23:44:19
tags:
- Hexo
- Hexo Usage
categories:
- Web
- Hexo
- Usage
Hexo 환경 설정(_config.yml)
_config.yml이란? Hexo 블로그의 기본 설정을 세팅하는 파일
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 현재 블로그의 _comfig.yml
# Site
title:Gwang'sblog# Hexo 블로그의 제목 탭의 이름
subtitle:Front-endDeveloperGwang'sBlog# Hexo 블로그의 부제목 테마별로 위치가 상이함
description:# Hexo 블로그에 대한 설명
author:gwang# Hexo 블로그 관리자
language:en# Hexo 블로그 기본세팅의 언어설정
timezone:
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url:http://yoursite.com
root:/
permalink::year/:month/:day/:title/
permalink_defaults:
# Directory
source_dir:source
public_dir:public
tag_dir:tags
archive_dir:archives
category_dir:categories
code_dir:downloads/code
i18n_dir::lang
skip_render:
# Writing
new_post_name::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:false
relative_link:false
future:true
highlight:
enable:true
line_number:true
auto_detect:true
tab_replace:
# Category & Tag
default_category:uncategorized
category_map:
tag_map:
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format:YYYY-MM-DD
time_format:HH:mm:ss
# Pagination
## Set per_page to 0 to disable pagination
per_page:10
pagination_dir:page
# 테마를 바꾸고 싶을 경우 변경해야함
# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme:hueman# 기본은 landscape
정적 파일 생성하기
서버에 배포하기 전에 정적파일을 생성해야 한다.
1
2
3
4
# public 폴더가 생성된다.
$ hexo generate
# 파일이 변경될 경우 바로바로 적용시키는 명령어
$ hexo generate --watch
Github에 배포하기
hexo-deployer-git 모듈이 있어야 배포가 가능하기 때문에 설치한다
1
$ npm install --save hexo-deployer-git
Github에 배포하기 위해 _config.yml파일에서 배포 환경 설정을 해준다.
1
2
3
4
5
6
7
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type:git# type은 github이 아니고 git이다.
# https://아이디.github.io 의 주소를 사용한다면 아래와 같이 해당 repo의 주소를 연결 master branch 설정