2014-02-20 19:04:08 -05:00
|
|
|
---
|
2016-01-06 17:45:19 -05:00
|
|
|
lastmod: 2015-01-27
|
2014-05-29 18:42:05 -04:00
|
|
|
date: 2013-07-09
|
2014-04-23 03:00:11 -04:00
|
|
|
menu:
|
|
|
|
main:
|
2014-05-29 18:42:05 -04:00
|
|
|
parent: extras
|
|
|
|
next: /extras/urls
|
|
|
|
prev: /extras/highlighting
|
|
|
|
title: Table of Contents
|
2014-11-25 03:07:18 -05:00
|
|
|
weight: 100
|
2014-02-20 19:04:08 -05:00
|
|
|
---
|
|
|
|
|
2014-08-31 07:08:36 -04:00
|
|
|
Hugo will automatically parse the Markdown for your content and create
|
2014-02-20 19:04:08 -05:00
|
|
|
a Table of Contents you can use to guide readers to the sections within
|
2014-05-15 09:58:55 -04:00
|
|
|
your content.
|
2014-02-20 19:04:08 -05:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Simply create content like you normally would with the appropriate
|
2014-05-15 09:58:55 -04:00
|
|
|
headers.
|
2014-02-20 19:04:08 -05:00
|
|
|
|
2014-08-31 07:08:36 -04:00
|
|
|
Hugo will take this Markdown and create a table of contents stored in the
|
2015-01-27 21:17:09 -05:00
|
|
|
[content variable](/layout/variables/) `.TableOfContents`
|
2014-02-20 19:04:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
## Template Example
|
|
|
|
|
2015-01-27 21:17:09 -05:00
|
|
|
This is example code of a [single.html template](/layout/content/).
|
2014-02-20 19:04:08 -05:00
|
|
|
|
2014-09-03 00:12:26 -04:00
|
|
|
{{ partial "header.html" . }}
|
2014-02-20 19:04:08 -05:00
|
|
|
<div id="toc" class="well col-md-4 col-sm-6">
|
|
|
|
{{ .TableOfContents }}
|
|
|
|
</div>
|
|
|
|
<h1>{{ .Title }}</h1>
|
|
|
|
{{ .Content }}
|
2014-09-03 00:12:26 -04:00
|
|
|
{{ partial "footer.html" . }}
|
2014-02-20 19:04:08 -05:00
|
|
|
|
|
|
|
|