From 5c54e8d409f2376011f120eeabc4a6c9311798fe Mon Sep 17 00:00:00 2001
From: Cory Dransfeldt <hi@coryd.dev>
Date: Sun, 2 Jun 2024 19:52:11 -0700
Subject: [PATCH] feat: populate blogroll from authors table

---
 package-lock.json                 |  4 +--
 package.json                      |  2 +-
 src/_data/blogroll.js             | 54 +++++++++++--------------------
 src/pages/secondary/blogroll.html | 10 +++---
 4 files changed, 27 insertions(+), 43 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 48bd5592..77ee3491 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "coryd.dev",
-  "version": "18.5.4",
+  "version": "18.6.4",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "coryd.dev",
-      "version": "18.5.4",
+      "version": "18.6.4",
       "license": "MIT",
       "dependencies": {
         "@cdransf/api-text": "^1.4.0",
diff --git a/package.json b/package.json
index dcd767c9..cfa298e8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "coryd.dev",
-  "version": "18.5.4",
+  "version": "18.6.4",
   "description": "The source for my personal site. Built using 11ty.",
   "type": "module",
   "scripts": {
diff --git a/src/_data/blogroll.js b/src/_data/blogroll.js
index 93ff5df7..cad95986 100644
--- a/src/_data/blogroll.js
+++ b/src/_data/blogroll.js
@@ -1,36 +1,20 @@
-export default async function () {
-  return [
-    { "name": "Adam Newbold", "url": "https://notes.neatnik.net", "feed": "https://notes.neatnik.net" },
-    { "name": "Adrianna Tan", "url": "https://popagandhi.com", "feed": "https://popagandhi.com/feed.xml", "newsletter": "https://buttondown.email/skinnylatte" },
-    { "name": "Ashur Cabrera", "url": "https://multiline.co/mment", "feed": "https://multiline.co/mment/feed.xml" },
-    { "name": "BinaryDigit", "url": "https://binarydigit.cafe", "feed": "https://binarydigit.cafe/feed.xml" },
-    { "name": "Chris Burnell", "url": "https://chrisburnell.com", "feed": "https://chrisburnell.com/feed.xml" },
-    { "name": "Chris Coyier", "url": "https://chriscoyier.net", "feed": "https://chriscoyier.net/feed/" },
-    { "name": "Chris Ferdinandi", "url": "https://gomakethings.com", "feed": "https://gomakethings.com/feed/index.xml", "newsletter": "https://gomakethings.com" },
-    { "name": "Chris McLeod", "url": "https://chrismcleod.dev", "feed": "https://chrismcleod.dev/feed.xml" },
-    { "name": "Dave Rupert", "url": "https://daverupert.com", "feed": "https://daverupert.com/atom.xml" },
-    { "name": "Ethan Marcotte", "url": "https://ethanmarcotte.com/wrote/", "feed": "https://ethanmarcotte.com/wrote/feed.xml" },
-    { "name": "fLaMEd", "url": "https://flamedfury.com", "feed": "https://flamedfury.com/feed.xml" },
-    { "name": "Jim Nielsen", "url": "https://blog.jim-nielsen.com", "feed": "https://blog.jim-nielsen.com/feed.xml", "json": "https://blog.jim-nielsen.com/feed.json" },
-    { "name": "Joe Steel", "url": "https://joe-steel.com", "feed": "https://joe-steel.com/feed.xml" },
-    { "name": "Joan Westenberg", "url": "https://joanwestenberg.com", "feed": "https://joanwestenberg.com/blog?format=rss", "newsletter": "https://joanwestenberg.com/subscribe" },
-    { "name": "Juha-Matti Santala", "url": "https://hamatti.org", "feed": "https://hamatti.org/feed/feed.xml", "newsletter":"https://www.syntaxerror.tech" },
-    { "name": "Keenan", "url": "https://gkeenan.co/avgb", "feed": "https://gkeenan.co/avglb?format=rss" },
-    { "name": "Kev Quirk", "url": "https://kevq.uk", "feed": "https://kevq.uk/feed.xml", "newsletter": "https://kevquirk.com/subscribe" },
-    { "name": "Łukasz Wójcik", "url": "https://lukaszwojcik.net", "feed": "https://blog.lukaszwojcik.net/full.xml" },
-    { "name": "Matt Birchler", "url": "https://birchtree.me", "feed": "https://birchtree.me/rss/" },
-    { "name": "Mike Haynes", "url": "https://crashthearcade.com", "feed": "https://crashthearcade.com/feed/rss" },
-    { "name": "Nick Heer", "url": "https://pxlnv.com", "feed": "https://feedpress.me/pxlnv", "json": "https://pxlnv.com/feed/json" },
-    { "name": "Paris Marx", "url": "https://disconnect.blog", "feed": "https://disconnect.blog/rss/", "newsletter": "https://disconnect.blog/#/portal/signup" },
-    { "name": "Paul Anthony Webb", "url": "https://webb.page" },
-    { "name": "Raymond Camden", "url": "https://raymondcamden.com", "feed": "https://www.raymondcamden.com/feed.xml", "newsletter": "https://www.raymondcamden.com/subscribe/" },
-    { "name": "Robb Knight", "url": "https://rknight.me", "feed": "https://rknight.me/subscribe/posts/rss.xml", "json": "https://rknight.me/subscribe/posts/feed.json" },
-    { "name": "Robin Rendle", "url": "https://robinrendle.com", "feed": "https://robinrendle.com/feed.xml", "newsletter": "https://robinrendle.com/the-cascade" },
-    { "name": "Ryan Broderick", "url": "https://www.garbageday.email", "feed": "https://rss.beehiiv.com/feeds/99VTTjt0N1.xml", "newsletter": "https://www.garbageday.email/subscribe" },
-    { "name": "Sara Joy", "url": "https://sarajoy.dev", "feed": "https://sarajoy.dev/rss.xml" },
-    { "name": "Sia Karamalegos", "url": "https://sia.codes", "feed": "https://sia.codes/feed/feed.xml", "newsletter": "https://sia.codes#inform" },
-    { "name": "Sophie Koonin", "url": "https://localghost.dev", "feed": "https://localghost.dev/rss" },
-    { "name": "Stephanie Eckles", "url": "https://thinkdobecreate.com", "feed": "https://thinkdobecreate.com/feed" },
-    { "name": "Zach Leatherman", "url": "https://www.zachleat.com", "feed": "https://www.zachleat.com/web/feed/" }
-  ]
+import { createClient } from '@supabase/supabase-js'
+
+const SUPABASE_URL = process.env.SUPABASE_URL
+const SUPABASE_KEY = process.env.SUPABASE_KEY
+const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
+
+export default async function fetchGenresWithArtists() {
+  const { data, error } = await supabase
+    .from('authors')
+    .select('*')
+    .eq('blogroll', true)
+    .order('name', { ascending: true })
+
+  if (error) {
+    console.error('Error fetching authors with for the blogroll:', error)
+    return []
+  }
+
+  return data
 }
\ No newline at end of file
diff --git a/src/pages/secondary/blogroll.html b/src/pages/secondary/blogroll.html
index 8859a58d..f5004093 100644
--- a/src/pages/secondary/blogroll.html
+++ b/src/pages/secondary/blogroll.html
@@ -17,17 +17,17 @@ description: These are awesome blogs that I enjoy and you may enjoy too.
     <td>{{ blog.name }}</td>
     <td><a href="{{ blog.url }}">{{ blog.url | replace: "https://", "" }}</a></td>
     <td class="blog-roll-icons">
-      {%- if blog.feed -%}
-      <a href="{{ blog.feed }}">{% tablericon "rss" "Subscribe via RSS" %}</a>
+      {%- if blog.rss_feed -%}
+      <a href="{{ blog.rss_feed }}">{% tablericon "rss" "Subscribe via RSS" %}</a>
       {%- else -%}
       —
       {%- endif -%}
+      {%- if blog.json_feed -%}
+      • <a href="{{ blog.json_feed }}">{% tablericon "json" "Subscribe via JSON" %}</a>
+      {%- endif -%}
       {%- if blog.newsletter -%}
       • <a href="{{ blog.newsletter }}">{% tablericon "mail-plus" "Newsletter subscription" %}</a>
       {%- endif -%}
-      {%- if blog.json -%}
-      • <a href="{{ blog.json }}">{% tablericon "json" "Subscribe via JSON" %}</a>
-      {%- endif -%}
     </td>
   </tr>
   {% endfor %}