hermit-V2/layouts/_default/single.html
2023-11-12 15:26:10 +00:00

35 lines
1 KiB
HTML

{{ define "head" }}
{{ if .Params.featuredImg -}}
<style>.bg-img {background-image: url('{{.Params.featuredImg}}');}</style>
{{- else if .Params.images -}}
{{- range first 1 .Params.images -}}
<style>.bg-img {background-image: url('{{. | absURL}}');}</style>
{{- end -}}
{{- end -}}
{{ end }}
{{ define "header" }}
{{ partial "header.html" . }}
{{ end }}
{{ define "main" }}
{{- if (or .Params.images .Params.featuredImg) }}
<div class="bg-img"></div>
{{- end }}
<main class="site-main section-inner thin animated fadeIn faster">
<h1>{{ .Title }}</h1>
<div class="content">
{{ .Content | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" `${1}<a href="#${2}" class="anchor" aria-hidden="true">{{- partial "svg.html" (dict "context" . "name" "content-anchor") -}}</a>${3}` | safeHTML }}
</div>
{{- if .Params.comments }}
<div id="comments" class="thin">
{{ partial "comments.html" . }}
</div>
{{- end }}
</main>
{{ end }}
{{ define "footer" }}
{{ partialCached "footer.html" . }}
{{ end }}