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.
This commit is contained in:
Eryn Wells 2025-08-28 07:52:55 -06:00
parent 90806aa8f6
commit 74c796d5cd
2 changed files with 45 additions and 0 deletions

View file

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

3
content/tweets/_index.md Normal file
View file

@ -0,0 +1,3 @@
---
title: Tweets
---