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.