Project

Jekyll 블로그에 고정 목차 달기

TOC

Table Of Contents

블로그에 목차를 달아주는 Jekyll Plugin.


설치

Gemfile 에 다음 한 줄 추가

 

gem 'jekyll-toc'

터미널 실행 후 다음 한 줄 입력

build install

build install

_config.yml 파일에서 gems: 섹션에 다음 두 줄 추가

 

plugins: 
	- jekyll-toc

터미널 실행 후 다음 한 줄 입력

jekyll serve --watch 로컬( http://localhost:4000 )에서 먼저 확인

이상 없으면 push

 


 

사용법

포스트마다 toc 여부 설정

포스트마다 toc 사용 여부를 설정할 수 있음

--- layout: post title: "Welcome to Jekyll!" toc: true ---

toc 커스터마이징

_config.yml 파일에서 jekyll-toc 설정을 커스터마이징 할 수 있음

toc: min_level: 1 
max_level: 6 
ordered_list: false 
no_toc_section_class: no_toc_section 
list_class: section-nav 
sublist_class: '' 
item_class: toc-entry 
item_prefix: toc-

toc 일괄 적용

_config.yml 파일 defaults: 섹션 수정

- scope: path: "" type: posts values: toc: true

scope: path: "" 
type: posts 
values: toc: true

toc 목차 고정시키기

_config.yml 파일 defaults: 섹션 수정

- scope: path: "" type: posts values: toc: true toc_sticky: true

scope: path: "" 
type: posts 
values: 
	toc: true 
   	toc_sticky: true

toc 목차 이름 수정하기

_config.yml 파일 defaults: 섹션 수정

- scope: path: "" type: posts values: toc: true toc_sticky: true toc_label: "Contents"

 

References:
https://blog.webjeda.com/jekyll-toc/
https://github.com/toshimaru/jekyll-toc

728x90