Add partial post_toc.html for table of content
This commit is contained in:
parent
ab7d847e21
commit
216780dc4b
3 changed files with 11 additions and 6 deletions
|
@ -9,6 +9,8 @@
|
||||||
* Responsive
|
* Responsive
|
||||||
* Card-based list layout
|
* Card-based list layout
|
||||||
* Internal Hugo templates for Open Graph and Twitter Cards meta data, google analytics, and Disqus comments
|
* Internal Hugo templates for Open Graph and Twitter Cards meta data, google analytics, and Disqus comments
|
||||||
|
* Table of contents
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ twitter_cards = true # Enable Twitter Cards if true
|
||||||
cardsPerRow = 2 # Possible values: 1, 2, 3
|
cardsPerRow = 2 # Possible values: 1, 2, 3
|
||||||
#mainSections = ["post"] # Set main page sections
|
#mainSections = ["post"] # Set main page sections
|
||||||
#dateFormat = "2006-01-02" # change the format of dates
|
#dateFormat = "2006-01-02" # change the format of dates
|
||||||
|
#comments:
|
||||||
|
#toc: true #
|
||||||
|
|
||||||
[Params.Social]
|
[Params.Social]
|
||||||
#facebook = "username"
|
#facebook = "username"
|
||||||
|
|
|
@ -5,12 +5,7 @@
|
||||||
{{- partial "post_thumbnail.html" (dict "page" . ) }}
|
{{- partial "post_thumbnail.html" (dict "page" . ) }}
|
||||||
<div class="post__meta meta mb">{{ partial "post_meta.html" . }}</div>
|
<div class="post__meta meta mb">{{ partial "post_meta.html" . }}</div>
|
||||||
<h1 class="post__title">{{ .Title }}</h1>
|
<h1 class="post__title">{{ .Title }}</h1>
|
||||||
{{ if eq .Params.toc true }}
|
{{- partial "post_toc.html" . }}
|
||||||
<details class="post__toc toc" {{ if .Params.tocOpen }}open{{ end }}>
|
|
||||||
<summary class="toc__title">{{- T "post_toc" -}}</summary>
|
|
||||||
{{ .TableOfContents }}
|
|
||||||
</details>
|
|
||||||
{{ end }}
|
|
||||||
<div class="post__content">{{ .Content }}</div>
|
<div class="post__content">{{ .Content }}</div>
|
||||||
{{ if .Params.tags }}
|
{{ if .Params.tags }}
|
||||||
<footer class="post__footer">
|
<footer class="post__footer">
|
||||||
|
|
6
layouts/partials/post_toc.html
Normal file
6
layouts/partials/post_toc.html
Normal 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 }}
|
Loading…
Reference in a new issue