Merge pull request #27 from funayman/add-toc

Add conditional table of contents
This commit is contained in:
Radek Kozieł 2020-05-28 18:32:33 +02:00 committed by GitHub
commit 565186853e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,21 @@
<img src="{{ . | absURL }}" class="post-cover" /> <img src="{{ . | absURL }}" class="post-cover" />
{{ end }} {{ end }}
{{ if .Params.Toc }}
<div class="table-of-contents">
<h1>
{{ if .Params.TocTitle }}
{{ .Params.TocTitle }}
{{ else if $.Site.Params.TocTitle }}
{{ $.Site.Params.TocTitle }}
{{ else }}
Table of Contents
{{ end }}
</h1>
{{ .TableOfContents }}
</div>
{{ end }}
<div class="post-content"> <div class="post-content">
{{- with .Content -}} {{- with .Content -}}
<div> <div>