erynwells.me/content/tweets/_content.gotmpl.tmp
Eryn Wells 74c796d5cd Section and content generator templates
This is not final. I think the content generator will ultimately operate on a
preprocessed version of the tweets JSON data from the Twitter archive.
2025-08-28 07:52:55 -06:00

42 lines
1 KiB
Text

{{/* vim: ft=gohtmltmpl: */}}
{{ $tweets := slice }}
{{ with resources.Get "twitter/tweets.json" }}
{{ with . | transform.Unmarshal }}
{{ $tweets = . }}
{{ end }}
{{ end }}
{{ range $tweets }}
{{ $tweet := .tweet }}
{{
$content := dict
"mediaType" "text/markdown"
"value" (partial "twitter/assembleTweetMarkdown.html" $tweet)
}}
{{ $creationDate := partial "twitter/parseCreatedAtDate.html" $tweet.created_at }}
{{ $title := printf "Tweet on %s" (time.Format "2 January 2005" $creationDate) }}
{{ $path := printf "%s/%s" $creationDate.Year $tweet.id_str }}
{{ $dates := dict "date" $creationDate }}
{{
$params := dict
"favoriteCount" $tweet.favorite_count
"retweetCount" $tweet.retweet_count
}}
{{
$page := dict
"title" $title
"dates" $dates
"content" $content
"kind" "page"
"params" $params
"path" $path
}}
{{ $.AddPage $page }}
{{ end }}