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:
parent
90806aa8f6
commit
74c796d5cd
2 changed files with 45 additions and 0 deletions
42
content/tweets/_content.gotmpl.tmp
Normal file
42
content/tweets/_content.gotmpl.tmp
Normal 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
3
content/tweets/_index.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
title: Tweets
|
||||||
|
---
|
Loading…
Add table
Add a link
Reference in a new issue