www.byjp.me/layouts/partials/reference-to.html
2024-10-11 10:17:16 +01:00

20 lines
990 B
HTML

{{- $url := .url -}}
{{- $references := .references -}}
{{- $mf2 := .mf2 -}}
{{- $hostname := (($url | urls.Parse).Hostname) -}}
{{- $reference := partial "reference.obj" . -}}
{{- if and (not $reference.name) (strings.HasPrefix $url "/") -}}
{{- $other := site.GetPage $url -}}
{{- if and $other $other.Page -}}
{{- $reference = dict "name" (partial "page-title.txt" $other.Page) "type" $other.Page.Type "internal" true -}}
{{- end -}}
{{- end -}}
{{ partialCached "svg.html" (dict "name" .svg) .svg }} {{ .phrase }}{{" "}}
{{- with $reference.name -}}
{{- if $reference.internal -}}my{{else}}the{{end}} {{ partial "article-type.txt" (default "article" $reference.type) }} {{ partial "rich-link.html" (dict "Class" (printf "%s h-cite" $mf2) "url" $url "Text" . "references" $references) }}.
{{- else -}}
{{- $text := printf "an article from %s" $hostname -}}
{{- partial "rich-link.html" (dict "Class" $mf2 "url" $url "Text" $text "references" $references) }}
{{- end }}