mirror of
https://github.com/Brandon-Rozek/website.git
synced 2025-08-04 07:32:00 +00:00
27 lines
No EOL
765 B
Go Template
27 lines
No EOL
765 B
Go Template
{{/* Get remote data. */}}
|
|
{{ $items := dict }}
|
|
{{ $url := "https://api.brandonrozek.com/observations" }}
|
|
{{ with try (resources.GetRemote $url ) }}
|
|
{{ with .Err }}
|
|
{{ errorf "Unable to get remote resource %s: %s" $url . }}
|
|
{{ else with .Value }}
|
|
{{ $items = . | transform.Unmarshal }}
|
|
{{ else }}
|
|
{{ errorf "Unable to get remote resource %s" $url }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ range $items.observations }}
|
|
{{ $dates := dict "date" (time.AsTime .created_at) }}
|
|
{{ $params := . }}
|
|
{{ $page := dict
|
|
"content" (dict "mediaType" "text/markdown" "value" "")
|
|
"dates" $dates
|
|
"kind" "page"
|
|
"params" $params
|
|
"path" .id
|
|
"title" ""
|
|
"build" (dict "render" "never")
|
|
}}
|
|
{{ $.AddPage $page }}
|
|
{{ end }} |