Add partial post_toc.html for table of content

This commit is contained in:
vimux 2018-05-25 13:03:05 +03:00
parent ab7d847e21
commit 216780dc4b
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
3 changed files with 11 additions and 6 deletions

View file

@ -9,6 +9,8 @@
* Responsive
* Card-based list layout
* Internal Hugo templates for Open Graph and Twitter Cards meta data, google analytics, and Disqus comments
* Table of contents
## Configuration
@ -31,6 +33,8 @@ twitter_cards = true # Enable Twitter Cards if true
cardsPerRow = 2 # Possible values: 1, 2, 3
#mainSections = ["post"] # Set main page sections
#dateFormat = "2006-01-02" # change the format of dates
#comments:
#toc: true #
[Params.Social]
#facebook = "username"

View file

@ -5,12 +5,7 @@
{{- partial "post_thumbnail.html" (dict "page" . ) }}
<div class="post__meta meta mb">{{ partial "post_meta.html" . }}</div>
<h1 class="post__title">{{ .Title }}</h1>
{{ if eq .Params.toc true }}
<details class="post__toc toc" {{ if .Params.tocOpen }}open{{ end }}>
<summary class="toc__title">{{- T "post_toc" -}}</summary>
{{ .TableOfContents }}
</details>
{{ end }}
{{- partial "post_toc.html" . }}
<div class="post__content">{{ .Content }}</div>
{{ if .Params.tags }}
<footer class="post__footer">

View file

@ -0,0 +1,6 @@
{{ if .Params.toc }}
<details class="post__toc toc" {{ if .Params.tocOpen }}open{{ end }}>
<summary class="toc__title">{{- T "post_toc" -}}</summary>
{{ .TableOfContents }}
</details>
{{ end }}