3

I have a layout in my Jekyll site for regular Markdown page, in which I'd like to place an outline of the page's headings. Can I access these headings in Jekyll or have them rendered in some other way, and if so, how?

Vincent
  • 4,876
  • 3
  • 44
  • 55

2 Answers2

3

In the depths of the answers to a tangentially related StackOverflow question, I found this answer:

https://github.com/allejo/jekyll-toc provides very easy way to add TOC to your jekyll page.

  1. Download the latest toc.html file (caution! should be raw file)
  2. copy this file to _includes folder.
  3. add this line before {{content}}: {% include toc.html html=content %}
Vincent
  • 4,876
  • 3
  • 44
  • 55
1

There is also jekyll-toc from toshimaru on GitHub. You can configure which level you want to parse, h1 to h6.

KargWare
  • 1,746
  • 3
  • 22
  • 35