mirror of
https://github.com/Brandon-Rozek/website.git
synced 2025-10-08 22:21:12 +00:00
Moved observation layout and programatically build pages from API
This commit is contained in:
parent
213ffb459d
commit
2217748994
4 changed files with 106 additions and 1 deletions
27
content/observations/_content.gotmpl
Normal file
27
content/observations/_content.gotmpl
Normal 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 }}
|
Loading…
Add table
Add a link
Reference in a new issue