vugo/layouts/_default/single.html

58 lines
1.7 KiB
HTML
Raw Normal View History

2022-08-18 14:17:23 +02:00
{{ define "main" }}
{{ if eq .Type $.Site.Params.contentTypeName }}
<div class="post-meta">
{{ if .Params.Date }}
<span>
<span class="post-date">
{{ .Date.Format "2006-01-02" }}
{{ if $.Site.Params.showLastUpdated }}
[{{or $.Site.Params.updatedDatePrefix "Updated"}}: {{ .Lastmod.Format "2006-01-02" }}]
{{ end }}
</span>
{{ end }}
{{ with .Params.Author }}
<span> - </span>
<span class="post-author">{{ . }}</span>
{{ end }}
{{ if and (.Param "readingTime") (eq (.Param "readingTime") true) }}
<span class="post-reading-time">- {{ .ReadingTime }} min read ({{ .WordCount }} words)</span>
{{ end }}
</span>
{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>&nbsp;
{{ end }}
</span>
{{ end }}
</div>
{{ end }}
{{ if (.Params.Toc | default .Site.Params.Toc) }}
<div class="table-of-contents">
<h2>
{{ (.Params.TocTitle | default .Site.Params.TocTitle) | default "Table of Contents" }}
</h2>
{{ .TableOfContents }}
</div>
{{ end }}
2022-09-18 12:29:02 +02:00
{{ if eq .Type $.Site.Params.contentTypeName }}
2022-08-18 14:17:23 +02:00
<div class="post-content">
2022-09-18 12:29:02 +02:00
{{- with .Content -}}
{{ . | replaceRE "(<h[1-9] id=\"([^\"]+)\".+)(</h[1-9]+>)" `${1} <a href="#${2}" class="anchor" ariaLabel="Anchor">#</a> ${3}` | safeHTML }}
{{- end -}}
2022-08-18 14:17:23 +02:00
</div>
2022-09-18 12:29:02 +02:00
{{ else }}
{{ .Content }}
{{ end }}
2022-08-18 14:17:23 +02:00
{{ if eq .Type $.Site.Params.contentTypeName }}
{{ partial "posts_pagination.html" . }}
{{ end }}
</div>
{{ end }}