- type: custom-api title: 💡 On This Day cache: 6h url: https://api.github.com/rate_limit template: | {{/* Top-level URL is a cheap dummy JSON; the real work is done inside the template via newRequest so we can compute today's date. Wikipedia's REST API requires a descriptive User-Agent per their policy (https://meta.wikimedia.org/wiki/User-Agent_policy) — an unset UA returns 403. */}} {{ $month := now | formatTime "01" }} {{ $day := now | formatTime "02" }} {{ $url := concat "https://en.wikipedia.org/api/rest_v1/feed/onthisday/events/" $month "/" $day }} {{ $resp := newRequest $url | withHeader "Accept" "application/json" | withHeader "User-Agent" "glance-dashboard/1.0 (+https://github.com/glanceapp/glance)" | getResponse }} {{ if ne $resp.Response.StatusCode 200 }}

Failed to load Wikipedia events ({{ $resp.Response.Status }})

{{ else }} {{ $events := $resp.JSON.Array "events" }} {{ if eq (len $events) 0 }}

No events found for today.

{{ else }} {{ end }} {{ end }}