mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 09:46:11 +01:00
15 lines
688 B
Text
15 lines
688 B
Text
{{- $src := path.Join (path.Dir .Page.RelPermalink) .src -}}
|
|
{{- $emoji := "🖼️" -}}
|
|
{{- $title := "Linked image" -}}
|
|
{{- if hasSuffix $src ".mp4" }}{{ $title = "Linked video" }}{{- $emoji = "📼" -}}{{ end -}}
|
|
{{- $caption := .caption -}}
|
|
{{- $captionChunks := split $caption "." -}}
|
|
{{- $shortCap := index $captionChunks 0 }}
|
|
{{- if and (lt (len $shortCap) 64) (gt (len $shortCap) 0) -}}
|
|
{{- $title = $shortCap -}}
|
|
{{- $caption = delimit (after 1 $captionChunks) "." -}}
|
|
{{- end -}}
|
|
{{- with .title }}{{if gt (len .) 0 }}{{ $title = . }}{{ end }}{{ end -}}
|
|
{{ "\n=>" }} {{ $src }} {{ $emoji }} {{ $title }}
|
|
{{- with $caption }}{{ if ne $title . }}
|
|
> {{ . }}{{ end }}{{ end -}}
|