diff --git a/Taskfile.yml b/Taskfile.yml
index 4a94135d..ac396496 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -12,7 +12,7 @@ tasks:
- lychee --cache --suggest --require-https .
dev:
cmds:
- - hugo server --minify
+ - hugo server --minify -D
build:
cmds:
- hugo --cacheDir /tmp/hugo/cache --minify --baseURL "https://www.byjp.me"
diff --git a/assets/scss/_links.scss b/assets/scss/_links.scss
new file mode 100644
index 00000000..6fbeb750
--- /dev/null
+++ b/assets/scss/_links.scss
@@ -0,0 +1,27 @@
+a[rel~="+agree"]:hover {
+ text-decoration-style: double;
+}
+a[rel~="-agree"]:hover {
+ text-decoration-style: dotted;
+}
+
+a[rel~="+accurate"]:hover {
+ position: relative;
+
+ &::after {
+ position: absolute;
+ vertical-align: super;
+ font-size: x-small;
+ content: "✓";
+ }
+}
+a[rel~="-accurate"]:hover {
+ position: relative;
+
+ &::after {
+ position: absolute;
+ vertical-align: super;
+ font-size: x-small;
+ content: "✗";
+ }
+}
diff --git a/assets/scss/_main.scss b/assets/scss/_main.scss
index 62c5337d..327ad24c 100644
--- a/assets/scss/_main.scss
+++ b/assets/scss/_main.scss
@@ -339,6 +339,11 @@ figure {
}
}
+caption {
+ font-size: 0.8rem;
+ opacity: 0.6;
+}
+
em, strong {
// Default
color: $light-color-variant;
diff --git a/assets/scss/_variables.scss b/assets/scss/_variables.scss
index 70cf9fee..f168a25b 100644
--- a/assets/scss/_variables.scss
+++ b/assets/scss/_variables.scss
@@ -31,6 +31,14 @@ $media-size-tablet: "(max-width: 900px)";
--tabletWidth: (max-width: 900px);
--accent: #8186FF;
--accentHue: 290;
+
+ @media (prefers-color-scheme: dark) {
+ --background: #232425;
+ }
+
+ @media (prefers-color-scheme: light) {
+ --background: #fff;
+ }
}
/* Content */
diff --git a/assets/scss/main.scss b/assets/scss/main.scss
index ab7c63ca..4c405890 100644
--- a/assets/scss/main.scss
+++ b/assets/scss/main.scss
@@ -18,3 +18,4 @@
@import "tables";
@import "404";
@import "search";
+@import "links";
diff --git a/content/bookmarks/a-primer-on-dopamine.md b/content/bookmarks/a-primer-on-dopamine.md
index 5c53c991..bcf5e316 100644
--- a/content/bookmarks/a-primer-on-dopamine.md
+++ b/content/bookmarks/a-primer-on-dopamine.md
@@ -6,6 +6,7 @@ bookmarkOf: https://invertedpassion.com/a-primer-on-dopamine/
references:
bookmark:
url: https://invertedpassion.com/a-primer-on-dopamine/
+ rel: +agree +accurate
type: entry
name: A primer on dopamine
summary: '1/ I recently made notes on the book "Hooked" but wasn''t satisfied
@@ -13,6 +14,17 @@ references:
of habit-forming products and that inevitably lead me to the (in)famous neurotransmitter
dopamine. 3/ Before we dive into what dopamine does, let''s first make one thing
clear: dopamine…'
+ games-problems:
+ url: https://invertedpassion.com/games-are-problems-people-pay-to-solve/
+ name: Games are problems people pay to solve
+ rel: +agree +accurate
+ skimmable:
+ url: https://invertedpassion.com/why-you-will-skim-this-article/
+ name: Why you will skim this article
+ rel: +agree +accurate
+ dopamine-and-value-of-work:
+ url: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4696912/
+ name: Mesolimbic Dopamine Signals the Value of Work
---
I really enjoyed reading about dopamine, desire and pleasure here! It’s worth a read, even if it slightly veers into the “how to abuse this knowledge for personal gain with your new product” space.
diff --git a/content/memex/art-design/colour.md b/content/memex/art-design/colour.md
index eeffc581..b546ea9f 100644
--- a/content/memex/art-design/colour.md
+++ b/content/memex/art-design/colour.md
@@ -11,6 +11,11 @@ tags:
- colour
- picker
- colour-scheme
+references:
+ lch-in-css:
+ url: https://lea.verou.me/blog/2020/04/lch-colors-in-css-what-why-and-how/
+ rel: +accurate
+ name: "LCH colors in CSS: what, why, and how?"
---
## Spelling
diff --git a/content/memex/art-design/fonts.md b/content/memex/art-design/fonts.md
index 62e65931..fc6590a9 100644
--- a/content/memex/art-design/fonts.md
+++ b/content/memex/art-design/fonts.md
@@ -8,6 +8,15 @@ tags:
- zwj
- emoji
- fonts
+references:
+ microsoft-ttf-docs:
+ url: https://learn.microsoft.com/en-us/typography/opentype/spec/
+ name: OpenType® Specification Version 1.9
+ rel: +accurate
+ apple-ttf-docs:
+ url: https://developer.apple.com/fonts/TrueType-Reference-Manual/
+ name: TrueType Reference Manual
+ rel: +accurate
---
## TTF Fonts
diff --git a/content/memex/art-design/tiles.md b/content/memex/art-design/tiles.md
index 342fb86a..70b00003 100644
--- a/content/memex/art-design/tiles.md
+++ b/content/memex/art-design/tiles.md
@@ -7,6 +7,11 @@ tags:
- shapes
- tiling
- colour
+references:
+ chiral-aperiodic-monotile:
+ url: https://cs.uwaterloo.ca/~csk/spectre/
+ name: A chiral aperiodic monotile
+ rel: +accurate
---
## Aperiodic monotiles
diff --git a/content/memex/computing/optimisation.md b/content/memex/computing/optimisation.md
index 18c1921f..2daae2c2 100644
--- a/content/memex/computing/optimisation.md
+++ b/content/memex/computing/optimisation.md
@@ -6,6 +6,11 @@ tags:
- optimisation
- lines
- svg
+references:
+ line-simplification:
+ url: https://bost.ocks.org/mike/simplify/
+ name: Line Simplification
+ rel: +accurate
---
## Line simplification
diff --git a/content/memex/games/gaming.md b/content/memex/games/gaming.md
index 202e9f3c..1f6f7a41 100644
--- a/content/memex/games/gaming.md
+++ b/content/memex/games/gaming.md
@@ -7,6 +7,11 @@ tags:
- manifesto
- play
- games
+references:
+ puzmo-manifesto:
+ url: https://www.puzzmo.com/public-manifesto
+ name: The Puzzmo Manifesto
+ rel: +agree
---
## Puzzmo manifesto
diff --git a/i18n/de.toml b/i18n/de.toml
deleted file mode 100644
index 7ef99a24..00000000
--- a/i18n/de.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for German
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Übersetzungen"
-
-[postAvailable]
-other = "Auch verfügbar auf"
-
-
-# 404.html
-#
-[archives]
-other = "Archiv"
-
-[home]
-other = "Home"
-
-[notFound]
-other = "Oops, Seite nicht gefunden ..."
-
-
-# posts/single.html
-#
-[readingTime]
-one = "Eine Minute"
-other = "{{ .Count }} Minuten"
-
-[tableOfContents]
-other = "Inhaltsverzeichnis"
-
-[wordCount]
-one = "Ein Wort"
-other = "{{ .Count }} Wörter"
-
-[lastModified]
-other = "Letzte Aktualisierung"
diff --git a/i18n/es.toml b/i18n/es.toml
deleted file mode 100644
index 1dce9bbc..00000000
--- a/i18n/es.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for Spanish
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Traducciones"
-
-[postAvailable]
-other = "También disponible en"
-
-
-# 404.html
-#
-[archives]
-other = "Archivo"
-
-[home]
-other = "Home"
-
-[notFound]
-other = "Oops, página no encontrada…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "Un minuto"
-other = "{{ .Count }} minutos"
-
-[tableOfContents]
-other = "Tabla de Contenido"
-
-[wordCount]
-one = "Una Palabra"
-other = "{{ .Count }} Palabras"
-
-[lastModified]
-other = "Ultima actualización"
diff --git a/i18n/fr.toml b/i18n/fr.toml
deleted file mode 100644
index 1ba6fe91..00000000
--- a/i18n/fr.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for French
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Traductions"
-
-[postAvailable]
-other = "Aussi disponible en"
-
-
-# 404.html
-#
-[archives]
-other = "Les archives"
-
-[home]
-other = "Accueil"
-
-[notFound]
-other = "Oups, page non trouvée …"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "Une minute"
-other = "{{ .Count }} minutes"
-
-[tableOfContents]
-other = "Table des matières"
-
-[wordCount]
-one = "Un Mot"
-other = "{{ .Count }} Mots"
-
-[lastModified]
-other = "Mise à jour"
diff --git a/i18n/gl.toml b/i18n/gl.toml
deleted file mode 100644
index 21e0e895..00000000
--- a/i18n/gl.toml
+++ /dev/null
@@ -1,36 +0,0 @@
-# Translations for Galician
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Traducións"
-
-[postAvailable]
-other = "Tamén dispoñible en"
-
-
-# 404.html
-#
-[archives]
-other = "Arquivos"
-
-[home]
-other = "Inicio"
-
-[notFound]
-other = "Vaia, non se atopou a páxina..."
-
-
-# posts/single.html
-#
-[readingTime]
-one = "Un minuto"
-other = "{{ .Count }} minutos"
-
-[tableOfContents]
-other = "Táboa de contidos"
-
-[wordCount]
-one = "Unha Palabra"
-other = "{{ .Count }} Palabras"
diff --git a/i18n/hi.toml b/i18n/hi.toml
deleted file mode 100644
index 6486c73b..00000000
--- a/i18n/hi.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for Hindi
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "अनुवाद"
-
-[postAvailable]
-other = "पढ़ें इस भाषा में"
-
-
-# 404.html
-#
-[archives]
-other = "पुरालेख"
-
-[home]
-other = "घर"
-
-[notFound]
-other = "क्षमा करें ! पेज़ नहीं मिला…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "एक मिनट"
-other = "{{ .Count }} मिनट"
-
-[tableOfContents]
-other = "अनुक्रमणिका"
-
-[wordCount]
-one = "एक शब्द"
-other = "{{ .Count }} शब्द"
-
-[lastModified]
-other = "आखरी अपडेट"
diff --git a/i18n/it.toml b/i18n/it.toml
deleted file mode 100644
index f78a5a03..00000000
--- a/i18n/it.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for English
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Traduzioni"
-
-[postAvailable]
-other = "Disponibile anche in"
-
-
-# 404.html
-#
-[archives]
-other = "Archivi"
-
-[home]
-other = "Home"
-
-[notFound]
-other = "Oops, pagina non trovata…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "Un minuto"
-other = "{{ .Count }} minuti"
-
-[tableOfContents]
-other = "Contenuti"
-
-[wordCount]
-one = "Una parola"
-other = "{{ .Count }} parole"
-
-[lastModified]
-other = "Ultimo aggiornamento"
diff --git a/i18n/ja.toml b/i18n/ja.toml
deleted file mode 100644
index 7350c231..00000000
--- a/i18n/ja.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for Japanese
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "翻訳"
-
-[postAvailable]
-other = "他の言語"
-
-
-# 404.html
-#
-[archives]
-other = "アーカイブ"
-
-[home]
-other = "ホームページ"
-
-[notFound]
-other = "あっ、ページが見つかりません……"
-
-# Please add hasCJKLanguage = true under [languages.ja] for the below to behave correctly
-# posts/single.html
-#
-[readingTime]
-one = "一分"
-other = "{{ .Count }}分"
-
-[tableOfContents]
-other = "目次"
-
-[wordCount]
-one = "一文字"
-other = "{{ .Count }}文字"
-
-[lastModified]
-other = "最終更新"
diff --git a/i18n/lmo.toml b/i18n/lmo.toml
deleted file mode 100644
index 7616ddab..00000000
--- a/i18n/lmo.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for English
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Traduzion"
-
-[postAvailable]
-other = "Disponibel anca in"
-
-
-# 404.html
-#
-[archives]
-other = "Archivi"
-
-[home]
-other = "Home"
-
-[notFound]
-other = "Oops, pagina minga trovada…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "On megnuu"
-other = "{{ .Count }} megnuu"
-
-[tableOfContents]
-other = "Contegnuu"
-
-[wordCount]
-one = "Ona parolla"
-other = "{{ .Count }} paroll"
-
-[lastModified]
-other = "Last update"
diff --git a/i18n/ml.toml b/i18n/ml.toml
deleted file mode 100644
index a6aa087d..00000000
--- a/i18n/ml.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for മലയാളം [Malayalam]
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "വിവർത്തനങ്ങൾ"
-
-[postAvailable]
-other = "ഈ പോസ്റ്റ് ലഭ്യമായ മറ്റ് ഭാഷകൾ:"
-
-
-# 404.html
-#
-[archives]
-other = "ശേഖരം"
-
-[home]
-other = "പ്രധാന താൾ"
-
-[notFound]
-other = "ക്ഷമിക്കണം. താൾ ലഭ്യമല്ല. ദേയവയി വിലാസം പരിശോധിക്കുക അല്ലെങ്കിൽ അൽപ സമയത്തിനു ശേഷം വീണ്ടും പരിശ്രമിക്കുക."
-
-
-# posts/single.html
-#
-[readingTime]
-one = "ഒരു മിനിറ്റ്"
-other = "{{ .Count }} മിനിറ്റുകൾ"
-
-[tableOfContents]
-other = "ഉള്ളടക്ക പട്ടിക"
-
-[wordCount]
-one = "ഒരു വാക്ക്"
-other = "{{ .Count }} വാക്കുകൾ"
-
-[lastModified]
-other = "അവസാനമായി പുതുക്കിയത്"
diff --git a/i18n/pt-br.toml b/i18n/pt-br.toml
deleted file mode 100644
index b53cbccb..00000000
--- a/i18n/pt-br.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for Portuguese
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Traduções"
-
-[postAvailable]
-other = "Também disponível em"
-
-
-# 404.html
-#
-[archives]
-other = "Arquivo"
-
-[home]
-other = "Início"
-
-[notFound]
-other = "Oops, página não encontrada…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "Um minuto"
-other = "{{ .Count }} minutos"
-
-[tableOfContents]
-other = "Índice"
-
-[wordCount]
-one = "Uma Palavra"
-other = "{{ .Count }} Palavras"
-
-[lastModified]
-other = "Última actualização"
diff --git a/i18n/ro.toml b/i18n/ro.toml
deleted file mode 100644
index af97a55b..00000000
--- a/i18n/ro.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for Romanian
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Traduceri"
-
-[postAvailable]
-other = "Disponibil și în"
-
-
-# 404.html
-#
-[archives]
-other = "Arhive"
-
-[home]
-other = "Acasă"
-
-[notFound]
-other = "Ups, pagina nu a fost găsită…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "Un minut"
-other = "{{ .Count }} de minute"
-
-[tableOfContents]
-other = "Cuprins"
-
-[wordCount]
-one = "Un cuvânt"
-other = "{{ .Count }} de cuvinte"
-
-[lastModified]
-other = "Ultima modificare"
diff --git a/i18n/ru.toml b/i18n/ru.toml
deleted file mode 100644
index 2f16ec40..00000000
--- a/i18n/ru.toml
+++ /dev/null
@@ -1,43 +0,0 @@
-# Translations for Russian
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Переводы"
-
-[postAvailable]
-other = "Доступно на "
-
-
-# 404.html
-#
-[archives]
-other = "Архивы"
-
-[home]
-other = "Главная"
-
-[notFound]
-other = "Упс, страница не найдена…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "{{ .Count }} минута"
-few = "{{ .Count }} минуты"
-many = "{{ .Count }} минут"
-other = "{{ .Count }} минут"
-
-[tableOfContents]
-other = "Содержимое"
-
-[wordCount]
-one = "{{ .Count }} слово"
-few = "{{ .Count }} слова"
-many = "{{ .Count }} слов"
-other = "{{ .Count }} слов"
-
-[lastModified]
-other = "Последнее обновление"
diff --git a/i18n/tr.toml b/i18n/tr.toml
deleted file mode 100644
index df7af322..00000000
--- a/i18n/tr.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for English
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Çeviriler"
-
-[postAvailable]
-other = "Ayrıca"
-
-
-# 404.html
-#
-[archives]
-other = "Arşiv"
-
-[home]
-other = "Ana Sayfa"
-
-[notFound]
-other = "Sayfa bulunamadı…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "Bir dakika"
-other = "{{ .Count }} dakika"
-
-[tableOfContents]
-other = "İçindekiler"
-
-[wordCount]
-one = "One Kelime"
-other = "{{ .Count }} Kelime"
-
-[lastModified]
-other = "Son güncelleme"
diff --git a/i18n/uk.toml b/i18n/uk.toml
deleted file mode 100644
index 890a6189..00000000
--- a/i18n/uk.toml
+++ /dev/null
@@ -1,43 +0,0 @@
-# Translations for Ukrainian
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "Переклади"
-
-[postAvailable]
-other = "Доступне на "
-
-
-# 404.html
-#
-[archives]
-other = "Архіви"
-
-[home]
-other = "Головна"
-
-[notFound]
-other = "Упс, сторінка не знайдена…"
-
-
-# posts/single.html
-#
-[readingTime]
-one = "{{ .Count }} хвилина"
-few = "{{ .Count }} хвилини"
-many = "{{ .Count }} хвилин"
-other = "{{ .Count }} хвилин"
-
-[tableOfContents]
-other = "Вміст"
-
-[wordCount]
-one = "{{ .Count }} слово"
-few = "{{ .Count }} слова"
-many = "{{ .Count }} слів"
-other = "{{ .Count }} слів"
-
-[lastModified]
-other = "Останнє оновлення"
diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml
deleted file mode 100644
index 7ed72a03..00000000
--- a/i18n/zh-cn.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for Chinese (China)
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "译文"
-
-[postAvailable]
-other = "其他语言"
-
-
-# 404.html
-#
-[archives]
-other = "档案"
-
-[home]
-other = "主页"
-
-[notFound]
-other = "噢,找不到页面……"
-
-# Please add hasCJKLanguage = true under [languages.zh-cn] for the below to behave correctly
-# posts/single.html
-#
-[readingTime]
-one = "一分钟"
-other = "{{ .Count }}分钟"
-
-[tableOfContents]
-other = "目录"
-
-[wordCount]
-one = "一字"
-other = "{{ .Count }}字"
-
-[lastModified]
-other = "最后修改"
diff --git a/i18n/zh-hk.toml b/i18n/zh-hk.toml
deleted file mode 100644
index 4f52ffc1..00000000
--- a/i18n/zh-hk.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for Chinese (Hong Kong) [Cantonese]
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "譯文"
-
-[postAvailable]
-other = "其他語言"
-
-
-# 404.html
-#
-[archives]
-other = "貼文"
-
-[home]
-other = "主頁"
-
-[notFound]
-other = "哎呀,揾唔到添……"
-
-# Please add hasCJKLanguage = true under [languages.zh-hk] for the below to behave correctly
-# posts/single.html
-#
-[readingTime]
-one = "一分鐘"
-other = "{{ .Count }}分鐘"
-
-[tableOfContents]
-other = "目錄"
-
-[wordCount]
-one = "一粒字"
-other = "{{ .Count }}字"
-
-[lastModified]
-other = "最後修改"
diff --git a/i18n/zh-tw.toml b/i18n/zh-tw.toml
deleted file mode 100644
index 4a83bac3..00000000
--- a/i18n/zh-tw.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Translations for Chinese (Taiwan)
-# https://gohugo.io/content-management/multilingual/#translation-of-strings
-
-# Generic
-#
-[translations]
-other = "譯文"
-
-[postAvailable]
-other = "其他語言"
-
-
-# 404.html
-#
-[archives]
-other = "檔案"
-
-[home]
-other = "主頁"
-
-[notFound]
-other = "噢,找不到頁面……"
-
-# Please add hasCJKLanguage = true under [languages.zh-tw] for the below to behave correctly
-# posts/single.html
-#
-[readingTime]
-one = "一分鐘"
-other = "{{ .Count }}分鐘"
-
-[tableOfContents]
-other = "目錄"
-
-[wordCount]
-one = "一字"
-other = "{{ .Count }}字"
-
-[lastModified]
-other = "最後修改"
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
index c4f4b1e4..98eaa1d6 100644
--- a/layouts/_default/_markup/render-link.html
+++ b/layouts/_default/_markup/render-link.html
@@ -1,18 +1 @@
-{{- $isExternal := strings.HasPrefix .Destination "http" -}}
-{{- $text := .Text -}}
-{{/* It pains me that Hugo doesn't have a urls.IsValid method, and has no error catching to allow me to try urls.Parse and catch failures */}}
-{{- if gt (len (strings.FindRE `^https?:\/\/[A-z0-9_-]*?[:]?[A-z0-9_-]*?[@]?[A-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$` .Text)) 0 -}}
- {{- $url := urls.Parse $text -}}
- {{- $text = strings.TrimPrefix "www." $url.Hostname -}}
- {{- if lt (len $url.Path) 16 -}}
- {{- $text = path.Join $text $url.Path -}}
- {{- else -}}
- {{- $parts := strings.Split $url.Path "/" -}}
- {{- $last := index ($parts | last 1) 0 -}}
- {{- if gt (len $last) 16 -}}
- {{- $last = printf "%s…" (strings.Substr $last 0 16) -}}
- {{- end -}}
- {{- $text = path.Join $text "…" $last -}}
- {{- end -}}
-{{- end -}}
-{{ $text }}
\ No newline at end of file
+{{ partial "rich-link.html" (dict "Text" .Text "Destination" .Destination "Title" .Title "Page" .Page) }}
\ No newline at end of file
diff --git a/layouts/partials/bookmark-of.html b/layouts/partials/bookmark-of.html
index 7f6ce942..34af5e3e 100644
--- a/layouts/partials/bookmark-of.html
+++ b/layouts/partials/bookmark-of.html
@@ -1,17 +1,18 @@
-{{ if not .Params.bookmarkOf}}
- {{ errorf "BookmarkOf partial called when no bookmark of param set" }}
-{{ end }}
+{{- if not .Params.bookmarkOf -}}
+ {{ errorf "BookmarkOf partial called when no bookmark of param set" -}}
+{{- end -}}
-{{ $url := .Params.bookmarkOf }}
-{{ $reference := dict }}
-{{ range .Params.references }}
- {{ if eq .url $url }}
- {{ $reference = . }}
- {{ end }}
-{{ end }}
+{{- $page := . -}}
+{{- $url := .Params.bookmarkOf -}}
+{{- $reference := dict -}}
+{{- range .Params.references -}}
+ {{- if eq .url $url -}}
+ {{- $reference = . -}}
+ {{- end }}
+{{- end -}}
💭 Thoughts on{{" "}}
{{- with $reference.name -}}
- the article {{ . }}.
+ the article {{ partial "rich-link.html" (dict "Class" "u-bookmark-of" "Destination" $url "Text" . "Page" $page) }}.
{{- else -}}
- an article from {{ ($url | urls.Parse).Hostname }}
+ {{ partial "rich-link.html" (dict "Class" "u-bookmark-of" "Destination" $url "Text" (printf "an article from %s" (($url | urls.Parse).Hostname)) "Page" $page) }}
{{- end }}
diff --git a/layouts/partials/rich-link.html b/layouts/partials/rich-link.html
new file mode 100644
index 00000000..1b839d1d
--- /dev/null
+++ b/layouts/partials/rich-link.html
@@ -0,0 +1,29 @@
+{{- $destination := .Destination -}}
+{{- $title := .Title -}}
+{{- $isExternal := strings.HasPrefix $destination "http" -}}
+{{- $text := .Text -}}
+{{/* It pains me that Hugo doesn't have a urls.IsValid method, and has no error catching to allow me to try urls.Parse and catch failures */}}
+{{- if gt (len (strings.FindRE `^https?:\/\/[A-z0-9_-]*?[:]?[A-z0-9_-]*?[@]?[A-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$` .Text)) 0 -}}
+ {{- $url := urls.Parse $text -}}
+ {{- $text = strings.TrimPrefix "www." $url.Hostname -}}
+ {{- if lt (len $url.Path) 16 -}}
+ {{- $text = path.Join $text $url.Path -}}
+ {{- else -}}
+ {{- $parts := strings.Split $url.Path "/" -}}
+ {{- $last := index ($parts | last 1) 0 -}}
+ {{- if gt (len $last) 16 -}}
+ {{- $last = printf "%s…" (strings.Substr $last 0 16) -}}
+ {{- end -}}
+ {{- $text = path.Join $text "…" $last -}}
+ {{- end -}}
+{{- end -}}
+{{- $ref := dict -}}
+{{- range $k, $refSpec := .Page.Params.references -}}
+ {{- if eq $refSpec.url $destination -}}
+ {{- $ref = $refSpec -}}
+ {{- if and (ne $title $ref.name) (ne $text $ref.name) -}}
+ {{- $title = printf "External article: %s" $ref.name -}}
+ {{- end -}}
+ {{- end -}}
+{{- end -}}
+{{ $text }}
\ No newline at end of file