Alex McFarlane

Useful Stuff

Automatic Table of Contents for Jekyll Blogs

Download the source code for this page here

Contents

Introduction

This is more of a personal bookmark so I don’t forget this super simple solution

Method

Include the following in the _config.yml file

markdown: kramdown

then add this line where you want the TOC to appear in the markdown blog entry

* This will become a table of contents (this text will be scraped).
{:toc}

This will also include Contents inside TOC which looks dumb.

Correct this by {:.no_toc} following a title you don’t want in the TOC.

References