yequari.com/layouts/partials/statuscafe.html

37 lines
1.1 KiB
HTML
Raw Normal View History

2024-04-25 06:22:05 +00:00
{{ $data := dict }}
{{ $url := "https://status.cafe/users/yequari/status.json" }}
{{ with resources.GetRemote $url }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
<div id="statuscafe">
{{ $data = .Content | transform.Unmarshal }}
{{ $length := len $data.content }}
{{ if eq $length 0 }}
No status
{{ else }}
{{ $timestrs := strings.Split $data.timeAgo " " }}
{{ $timeamt := index $timestrs 0 }}
{{ $timeunit := index $timestrs 1 }}
{{ $timeunit = strings.Substr $timeunit 0 1 }}
{{ $url = "https://status.cafe/users/yequari/badge.png" }}
{{ with resources.GetRemote $url}}
<div id="statuscafe-username">
<a href="https://status.cafe/users/yequari"><img src="{{ .RelPermalink }}" alt="Status Cafe Profile"/></a>
</div>
{{ end }}
<div id="statuscafe-timeago">
🕗{{ $timeamt }}{{ $timeunit }}
</div>
<div id="statuscafe-content">
<p>
2024-05-06 04:42:20 +00:00
{{ htmlUnescape $data.content }}
2024-04-25 06:22:05 +00:00
</p>
</div>
</div>
{{ end }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}