{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}} {{- define "content" -}} {{- $params := .Scratch.Get "params" -}} {{- $toc := .Scratch.Get "toc" -}}
{{- /* Title */ -}}

{{- $repost := $params.repost | default dict -}} {{- with $repost -}} {{- if eq .Enable true -}} {{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}} {{- $title := cond (hasPrefix .Url "http") (printf "%v -> %v" (T "single.repost") .Url ) (T "single.repost") -}} {{- if hasPrefix .Url "http" -}} {{ dict "Destination" .Url "Icon" $icon "Class" "icon-repost" "Title" $title | partial "plugin/link.html" -}} {{- else -}} {{- $icon | partial "plugin/icon.html" -}} {{- end -}} {{- end -}} {{- end -}} {{- .Title -}}

{{- /* Subtitle */ -}} {{- with $params.subtitle -}}

{{ . }}

{{- end -}}
{{- /* Meta */ -}}
{{- /* Featured image */ -}} {{- $image := $params.featuredimage -}} {{- with .Resources.GetMatch "featured-image" -}} {{- $image = .RelPermalink -}} {{- end -}} {{- with $image -}} {{- end -}} {{- /* Static TOC */ -}} {{- if (ne $toc.enable false) | and (ne $tocEmpty true) -}}
{{ T "single.contents" }} {{ dict "Class" "details-icon fa-solid fa-angle-right" | partial "plugin/icon.html" }}
{{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- end -}} {{- /* Content */ -}} {{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} {{- if $params.password -}} {{- $saltLen := strings.RuneCount (trim $params.password "") -}} {{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}} {{- $base64EncodeContent := $content | base64Encode -}} {{- $content = printf "%v%v%v" (substr $base64EncodeContent 0 $saltLen) (substr (sha256 $params.password) $saltLen) (substr $base64EncodeContent $saltLen) -}} {{- end -}}
{{- if not $params.password -}} {{- /* Expiration Reminder */ -}} {{- partial "single/expiration-reminder.html" . -}} {{- $content -}} {{- else -}} {{- partial "single/fixit-decryptor.html" . -}} {{- end -}}
{{- /* Footer and Reward */ -}} {{- $reward := .Scratch.Get "reward" -}} {{- if eq $reward.position "before" -}} {{- partial "single/reward.html" . -}} {{- partial "single/footer.html" . -}} {{- else -}} {{- partial "single/footer.html" . -}} {{- partial "single/reward.html" . -}} {{- end -}} {{- /* Comment */ -}} {{- partial "single/comment.html" . -}}
{{- end -}}