site/layouts/posts/single.gmi

42 lines
1.2 KiB
Plaintext

{{ define "content" -}}
# {{ $.Title }}
Posted {{ .Date.Format "2006-01-02" }}
{{- $lastmod := .Lastmod }}
{{- if lt .Date $lastmod }}
Last updated {{ .Lastmod.Format "2006-01-02" }}
{{- end }}
{{- $taxonomy := "tags" }}
{{- with .Param $taxonomy }}
{{- if gt (len .) 1 }}
Tags:
{{- else if gt (len .) 0 }}
Tag:
{{- end -}}
{{ range $index, $tag := . -}}{{- with $.Site.GetPage (printf "/%s/%s" $taxonomy $tag) -}}
{{- if $index -}}, {{ end -}}{{ if (not $index) }}{{printf " "}}{{end}}{{ $tag | urlize }}{{- end -}}{{- end }}
{{- end }}
--
{{- /*
* https://discourse.gohugo.io/t/using-renderstring-to-expand-shortcodes/40994/7
* support for using shortcodes in gemtext whilst having content as raw text.
*/ -}}
{{- $content := printf "~~~\n%s~~~" (trim (readFile (replace $.File.Path ".md" ".gmi")) "\n" | safeHTML) | .Page.RenderString | htmlUnescape }}
{{- $lines := split $content "\n" }}
{{- range $i, $_ := $lines }}
{{- if and $i (ne $i (sub (len $lines) 1)) }}
{{ . }}
{{- end -}}
{{- end -}}
--
Questions/comments:
=> mailto:~hedy/posts@lists.sr.ht Public gemlog mailing list (plain-text only)
=> mailto:{{ .Site.Author.email }} Or email me directly
=> / Home
{{- end }}