Moved observation layout and programatically build pages from API

This commit is contained in:
Brandon Rozek 2025-06-10 21:49:29 -04:00
parent 213ffb459d
commit 2217748994
No known key found for this signature in database
GPG key ID: DFB0E78F805F4567
4 changed files with 106 additions and 1 deletions

View file

@ -0,0 +1,27 @@
{{/* 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 }}