# .TableOfContents

**URL:** <https://discourse.gohugo.io/t/tableofcontents/1616>\
**Category:** support\
**Created:** [August 25, 2015, 11:41pm UTC](https://discourse.gohugo.io/t/tableofcontents/1616 "2015-08-25T23:41:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![croffler](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@croffler](https://discourse.gohugo.io/u/croffler)\
**Post date:** [August 25, 2015, 11:41pm UTC](https://discourse.gohugo.io/t/tableofcontents/1616/1 "2015-08-25T23:41:50Z")

</div>

According to the docs it should be possible to put {{ .Page.TableOfContents }} on a page and the TOC should show up.

However, this does not seem to work, even when I create a shortcode it does not work. When I put it in a partial layout then it works. I would like to be able to choose the pages where I place the toc.

Is there a solution for this ?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [August 26, 2015, 7:41am UTC](https://discourse.gohugo.io/t/tableofcontents/1616/2 "2015-08-26T07:41:35Z")

</div>

You can not access ToC from shortcode (this is the chicken and the egg).

Use a page param `toc=true` or something. See the Hugo docs for an example.

---

<div class="post-metadata">

**Author:** ![croffler](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@croffler](https://discourse.gohugo.io/u/croffler)\
**Post date:** [August 26, 2015, 8:07am UTC](https://discourse.gohugo.io/t/tableofcontents/1616/3 "2015-08-26T08:07:17Z")

</div>

Sorry, but do not understand how I would do this. Can you give an example, can’t find anything in the docs on how to do this

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [August 26, 2015, 9:50am UTC](https://discourse.gohugo.io/t/tableofcontents/1616/4 "2015-08-26T09:50:26Z")

</div>

[https://github.com/spf13/hugo/blob/master/docs/layouts/\_default/single.html#L2](https://github.com/spf13/hugo/blob/master/docs/layouts/_default/single.html#L2)

---

<div class="post-metadata">

**Author:** ![croffler](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@croffler](https://discourse.gohugo.io/u/croffler)\
**Post date:** [August 26, 2015, 12:17pm UTC](https://discourse.gohugo.io/t/tableofcontents/1616/5 "2015-08-26T12:17:09Z")

</div>

Thanks

Is there a way to control the levels the TOC is displaying ?  
eg. only show h1 ?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [August 26, 2015, 12:27pm UTC](https://discourse.gohugo.io/t/tableofcontents/1616/6 "2015-08-26T12:27:06Z")

</div>

Only via CSS. There is a thread about it in here somewhere.

---

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [August 26, 2015, 1:17pm UTC](https://discourse.gohugo.io/t/tableofcontents/1616/7 "2015-08-26T13:17:35Z")

</div>

You mean this [thread](http://discuss.gohugo.io/t/exclude-some-head-levels-from-tableofcontents/1380), right.

---

<div class="post-metadata">

**Author:** ![croffler](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@croffler](https://discourse.gohugo.io/u/croffler)\
**Post date:** [August 26, 2015, 1:55pm UTC](https://discourse.gohugo.io/t/tableofcontents/1616/8 "2015-08-26T13:55:48Z")

</div>

yup that’s it

tks
