1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-19 20:02:10 +00:00

Add bookmarks page

Pulls content exported from Buku, so I don't have to commit every time I
add a bookmark.

Since I added another nav item, I had to adjust the navbar css.
This commit is contained in:
Rohan Kumar 2022-03-07 22:30:16 -08:00
parent e693672c98
commit 4b6cfbb9ed
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
6 changed files with 61 additions and 2 deletions

View file

@ -6,6 +6,7 @@ music.txt.gz
music.txt.br
webmentions/
noindex/
data/
*d3.html
*d1.html
*fc.html

View file

@ -58,7 +58,7 @@ nav li {
}
/* single-line nav on widescreen, multi-line nav on narrow screens */
@media (min-width: 24em) {
@media (min-width: 32em) {
nav li {
display: inline;
}

View file

@ -32,6 +32,13 @@ nick = "Seirdy"
url = "/posts.html"
weight = 10
[[menu.main]]
identifier = "bookmarks"
name = "Bookmarks"
title = "bookmarks"
url = "/bookmarks.html"
weight = 11
[[menu.main]]
identifier = "about"
name = "About"

View file

@ -5,7 +5,8 @@ outputs:
title: Seirdy's Home
description: "Seirdy's Home: personal website and blog for Rohan Kumar, A.K.A. Seirdy. I write about and develop software to promote user autonomy."
sitemap:
- Priority: 1.0
- ChangeFreq: weekly
- Priority: 0.9
---
<div itemprop="author" itemscope itemtype="https://schema.org/Person" class="p-author autho h-card vcard">

11
content/bookmarks.md Normal file
View file

@ -0,0 +1,11 @@
---
outputs:
- html
layout: bookmarks
title: My bookmarks
description: "Links from around the web, curated and annotated by Rohan Kumar."
sitemap:
- ChangeFreq: daily
---
Here's a filtered selection of my personal bookmarks. Using [a shell script](https://git.sr.ht/~seirdy/dotfiles/tree/master/Executables/shell-scripts/bin/buku-upload), I regularly export specially-tagged entries from my [buku](https://github.com/jarun/buku) database to [a JSON file](https://seirdy.one/data/bookmarks.json). During site rebuilds, Hugo automatically pulls content from that file to build this page. This approach allows me to use an interactive interface to build my bookmarks database without needing a dynamic site.

View file

@ -0,0 +1,39 @@
{{ 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</code>, as per <cite><a href="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a></cite> and <cite><a href="https://xkcd.com/1179/">ISO 8601</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 }}