hugo-themes/antidocs/layouts/_default/single.html
2024-02-11 01:09:03 +01:00

40 lines
1.1 KiB
HTML

{{ define "main" }}
<div class="article-head">
<h1>
{{ .Title | markdownify }}
-
{{ if .Params.Author }}
{{ .Params.Author | markdownify }}
{{ end }}
</h1>
<span class="post-reading-time">~ {{ .ReadingTime }} min ({{ .WordCount }} {{ (.Params.WordCounter | default .Site.Params.WordCounter) | default "words" }})</span>
{{ if .Params.documentSource }}
<code><a href="{{ .Params.documentSource }}">markdown source</a></code>
{{ end }}
</div>
{{ if (.Params.Toc | default .Site.Params.Toc) }}
<h2>
{{ (.Params.TocTitle | default .Site.Params.TocTitle) | default "Table of Contents" }}
</h2>
{{ .TableOfContents }}
{{ end }}
<article class="post-content">
{{- with .Content -}}
{{ . | replaceRE "(<h[1-9] id=\"([^\"]+)\".+)(</h[1-9]+>)" `${1} <a href="#${2}" class="anchor" ariaLabel="Anchor">§</a> ${3}` | safeHTML }}
{{- end -}}
</article>
{{ if .Params.sources }}
<hr/>
<h3 class="post-reading-time">{{ ( .Params.SourcesName | default .Site.Params.SourcesName) | default "sources" }}:</h3>
<ol>
{{ range .Params.sources }}
<li class="post-tags"><a href="{{ . }}">{{ . }}</a></li>
{{ end }}
</ol>
{{ end }}
{{ end }}