The jekyll-toc package provides a plugin for jekyll which provides a liquid filter to produce a table of contents at the beginning of posts and / or pages.

To enable this plugin for a jekyll site, add jekyll-toc to the plugins in _config.yml:

  - jekyll-toc

When using bundler to run jekyll, also add jekyll-toc to the gems in the Gemfile:

group :jekyll_plugins do
  gem "jekyll-toc"