Misc :: hugo

hugo

Table of Contents

[markup]
    [markup.tableOfContents]
        endLevel = 3
        ordered = false
        startLevel = 2
    <aside class="toc">
        {{ if .Params.include_toc }}
            <h4>Table of Contents</h4>
            {{ .TableOfContents }}
        {{ end }}
    </aside>

enable syntax highlight

pygmentsCodeFences = true
pygmentsUseClasses = true
hugo gen chromastyles --style=trac > static/css/syntax.css

Range in Section

{{ range .CurrentSection.RegularPages }}
    <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}

Sort

{{ range .RegularPages.ByWeight }}
    <li><a href="{{.Permalink}}">{{ .Title }}</a></li>
{{ end }}