Toc and Other

I slightly regret wanting to build the site without a nice theme…


One of the fist features i want to add is a table of contents. For this i did the following:

In the config.yaml:

    endLevel: 3
    ordered: false
    startLevel: 2

In layouts/_default/single.html:

{{ define "main" }}
        <h1>{{ .Title }}</h1>
        {{ .Content }}
        {{ .TableOfContents }}
{{ end }}

In the front matter of the posts:

toc: true

I also added this in my default architype.

This gives me a very ugly TOC at the end of the page, but it’s something to work with.