1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 21:02:09 +00:00
seirdy.one/layouts/_default/bookmarks.html
2022-03-10 22:53:29 -08:00

39 lines
2 KiB
HTML

{{ define "main" }}
<div class="h-feed hfeed" itemscope itemtype="https://schema.org/DataFeed">
<h1 id="bookmarks" class="p-name" itemprop="name headline">My book&shy;marks</h1>
{{ .Content }}
<p><em>Timestamp format: <code>YYYY-MM-DD HH:MM</code>, as per <cite><a href="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a></cite></em></p>
<ul class="unstyled-list">
{{ $bookmarks := getJSON "https://seirdy.one/data/bookmarks.json" -}}
{{ range sort $bookmarks "tags" "desc" -}}
{{ $bookmark := . -}}
<li>
<article class="h-entry hentry" itemprop="dataFeedElement" itemscope itemtype="https://schema.org/SocialMediaPosting https://schema.org/DataFeedItem">
<meta itemprop="headline" content="{{ $bookmark.title }}"> <!--Just because we can't have one headline refer to two items-->
<h3 itemprop="sharedContent" itemscope itemtype="https://schema.org/WebPage" class="p-name">
<a itemprop="url" href="{{ $bookmark.uri }}" class="u-bookmark-of h-cite">
<span itemprop="headline">{{ $bookmark.title }}</span>
</a>
</h3>
{{- $tags := split $bookmark.tags "," -}}
{{- $firstTag := index $tags 0 }}
{{- $timestamp := dateFormat "2006-01-02 15:04:05-0700" $firstTag }}
<p>
Bookmarked on: <time class="dt-published published" itemprop="datePublished" datetime="{{ dateFormat "2006-01-02 15:04:05Z07:00" $timestamp }}" title="{{ dateFormat "2006-01-02 15:04:05Z07:00" $timestamp }}">{{ dateFormat "2006-01-02 15:04" $timestamp }}</time>
<br>Tags: <span itemprop="keywords">
{{ printf "<span class=\"p-category\">%s</span>" (index $tags 1) | safeHTML }}
{{- range after 2 $tags -}}
{{- $tag := . -}}
{{- if (ne $tag "public") -}}
{{- printf ", <span class=\"p-category\">%s</span>" $tag | safeHTML -}}
{{ end -}}
{{- end }}
</span>
</p>
<p class="e-summary entry-summary" itemprop="description">{{ markdownify $bookmark.description }}</p>
</article>
</li>
{{- end }}
</ul>
</div>
{{ end }}