hugo-WonderMod/layouts/_default/single.html
Aditya Telange a8652f57f3
toc: add option to open toc details by default
usage: in page params add (yml)
TocOpen: true
2020-09-16 15:41:28 +05:30

54 lines
1.6 KiB
HTML

{{ define "main" }}
<article class="post-single">
<header class="post-header">
<h1 class="post-title">
{{ .Title }}
{{- if .Draft }}<div class="entry-isdraft"><sup>&nbsp;&nbsp;[draft]</sup></div>{{- end }}
</h1>
{{ if .Params.hideMeta }}{{ else }}
<div class="post-meta">
<time>{{ .Date.Format "January 2, 2006" }}</time>
{{ if or .Params.author .Site.Params.author }} . {{ .Params.author | default .Site.Params.author }}{{ end }}
{{ if $.Site.Params.ShowReadingTime }} . {{ .ReadingTime }}{{ i18n "read_time" | default "min read" }}{{ end }}
</div>
{{end}}
</header>
{{ if .Params.cover }}
<figure class="entry-cover">
<img src="{{ .Params.cover | absURL }}" alt="cover image for {{ .Title | plainify }}">
</figure>
{{ end }}
{{ if .Params.ShowToc }}
<div class="toc">
<details {{if .Params.TocOpen }} open{{ end }}>
<summary>
<div class="details">Table of Contents</div>
</summary>
<blockquote>
{{ .TableOfContents }}
</blockquote>
</details>
</div>
{{ end }}
<div class="post-content">{{ .Content }}</div>
<footer class="post-footer">
{{- if .Params.tags }}
<ul class="post-tags">
{{- range .Params.tags }}
{{- $href := print (absLangURL "tags/") (urlize .) }}
<li><a href="{{ $href }}">{{ . }}</a></li>
{{- end }}
</ul>
{{- end }}
{{ if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true) ) }}
{{ partial "share-icons.html" . }}
{{ end }}
</footer>
{{- if $.Site.Params.comments }}
{{- partial "comments.html" . }}
{{- end }}
</article>
{{ end }}{{/* end main */}}