Files
blog/layouts/_partials/thought_text.html
2026-11-05 11:58:07 +00:00

11 lines
392 B
HTML

{{- /* A thought is the first H1 in the page body. The front matter title is only a formality. */ -}}
{{- $matches := findRE `<h1[^>]*>[\s\S]*?</h1>` .Content 1 -}}
{{- $text := "" -}}
{{- with $matches -}}
{{- $text = index . 0 | plainify | htmlUnescape | strings.TrimSpace -}}
{{- end -}}
{{- if not $text -}}
{{- $text = .Plain | strings.TrimSpace -}}
{{- end -}}
{{- return $text -}}