website-theme/layouts/shortcodes/displayToot.html

15 lines
446 B
HTML

{{ $toot_reference := .Get 0 }}
{{ $url := printf "data/toots/%s.json" $toot_reference }}
{{ $dataJ := dict }}
{{ with try (resources.Get $url) }}
{{ with .Err }}
{{ errorf "Unable to get resource %s: %s" $url . }}
{{ else with .Value }}
{{ $dataJ = . | transform.Unmarshal }}
{{ else }}
{{ errorf "Unable to get resource %s" $url }}
{{ end }}
{{ end }}
w
{{ .Scratch.Set "toot" $dataJ }}
{{ partial "external/toot.html" . }}