provides an API. Simply using curl
and jq
gives me all the data I need:
curl https://ch.tetr.io/api/users/geuze/summaries/league | jq '.data | .tr'
I store this data as a site parameter in my hugo.toml
file:
TETRIO_TR = 3090.2731291544947
TETRIO_RANK = "c+"
Now, I can use it in a Hugo shortcode:
<span>
{{ printf "%.2f" .Site.Params.TETRIO_TR }} TR
(<img class="tr_rank"
src="https://tetr.io/res/league-ranks/{{ .Site.Params.TETRIO_RANK }}.png" />)
</span>
Which looks like this: 11952.22 TR ().
To keep this value up-to-date, I add it to a GitHub Actions workflow that uses the game’s API to retrieve my TR and rank, and replaces the current value in the
hugo.toml
file using sed
.