Hike News
Hike News

hexo 설정

install

node.js가 설치되었다는 가정하에 아래커맨드로 설치

1
npm install -g hexo-cli

TODO

hexo가 설치된 상황에서 hexo project 설정 시

1
npm install

특수태그

Hexo에서 markdown에서만 사용가능한 특수태그

1.source code처리

1
2
3
{% codeblock Array.map %}
array.map(callback[, thisArg])
{% endcodeblock %}

아래는 결과

Array.map
1
array.map(callback[, thisArg])

2.강조인용

1
2
3
{% blockquote David Levithan, Wide Awake %}
Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.
{% endblockquote %}

아래는 결과

Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.

David LevithanWide Awake

3. youtube

1
{% youtube rs5YzOOD24w %}

아래는 결과

4. jsfiddle

1
{% jsfiddle g64atfz2 html,css,result %}

아래는 결과

SEO

플러그인 설치로 SEO 가능하게 하기

  1. 대표 URL 설치(npm install –save hexo-auto-canonical)
    설치 후, 설정된 테마의 head.ejs 소스의 meta 영역에 다음과 같은 코드를 기입해야 한다.
1
<%- autoCanonical(config, page) %>

그리고 root에 있는 _config.yml에 다음과 같이 서비스될 사이트 주소를 명시해야 한다. 다음 예제에서는 “https://adsloader.bitbucket.io"로 설정을 했다.

1
2
3
4
5
6
7
8
9
10
11

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://adsloader.bitbucket.io
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks


  1. sitemap 자동생성(npm install hexo-generator-seo-friendly-sitemap –save)

설치 후, 다음과 같이 _config.yml에 sitemap 정보를 저장한다.

1
2
3
4
5
sitemap:
path: sitemap.xml
tag: false
category: false