Skip to content

Commit

Permalink
Move TOC to sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
joeroe committed May 3, 2023
1 parent 8ab4d0a commit d59c813
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions exampleSite/config.toml
Expand Up @@ -63,6 +63,15 @@ series = "series"
[markup.goldmark.renderer]
unsafe = true

[markup]

# Table of contents
# Add toc = true to content front matter to enable
[markup.tableOfContents]
startLevel = 2
endLevel = 3
ordered = true

[privacy]

[privacy.vimeo]
Expand Down
7 changes: 6 additions & 1 deletion layouts/_default/single.html
Expand Up @@ -4,7 +4,6 @@ <h1>{{ .Title | markdownify }}</h1>
</header>
{{ if .Params.toc }}
<aside>
{{ .TableOfContents }}
</aside>
{{ end }}
<div class="content__body">
Expand All @@ -21,4 +20,10 @@ <h1>{{ .Title | markdownify }}</h1>
{{ if .Date }}{{ .Date.Format "2006-01-02" }}{{ end }}
</p>
{{ end }}

{{ if and (.Params.toc) (.TableOfContents) }}
<hr>
On this page:
{{ .TableOfContents }}
{{ end }}
{{ end }}
1 change: 1 addition & 0 deletions static/css/typography.css
Expand Up @@ -212,3 +212,4 @@ img {
max-width: 100%;
height: auto;
}

0 comments on commit d59c813

Please sign in to comment.