Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ other = "error"

[link_to_heading]
other = "Link to heading"

[entry_toc]
other = "Table of Contents"
9 changes: 9 additions & 0 deletions layouts/_partials/toc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- $toc := default .Site.Params.Entry.toc .Params.toc -}}
{{- $tocOpen := default .Site.Params.Entry.tocOpen .Params.tocOpen -}}

{{- if $toc }}
<details class="entry__toc toc" {{ if $tocOpen }}open{{ end }}>
<summary class="toc__title">{{- T "entry_toc" -}}</summary>
{{ .TableOfContents }}
</details>
{{- end }}
2 changes: 2 additions & 0 deletions layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ <h1 class="title">
</div>
</header>

{{ partial "toc.html" . }}

<div class="post-content">
{{ if .Params.featuredImage }}
<img src="{{ .Params.featuredImage | relURL }}" alt="Featured image"/>
Expand Down