From 423e8af0928353f264c7c8b80fcb9d58d6e545d0 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Fri, 26 May 2023 08:42:21 -0700 Subject: [PATCH] chore: add links json feed --- src/feeds.md | 2 +- src/links.11ty.liquid | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/links.11ty.liquid diff --git a/src/feeds.md b/src/feeds.md index 4cda83b2..8d8e3e1c 100644 --- a/src/feeds.md +++ b/src/feeds.md @@ -25,5 +25,5 @@ class="m-0 text-xl font-black leading-tight tracking-normal dark:text-gray-200 m - Posts ([RSS](/feed.xml) • [JSON](/feed.json)): a feed of all of my blog posts. -- Links ([RSS](/links.xml)): a feed of links I've shared via the Pinboard API. +- Links ([RSS](/links.xml) • [JSON](/links.json)): a feed of links I've shared via the Pinboard API. - Follow ([JSON](/follow.json)): a JSON feed of my web activity comprised of blog posts, links, movies and books (using the same data sources as [my now page](/now)). diff --git a/src/links.11ty.liquid b/src/links.11ty.liquid new file mode 100644 index 00000000..855df35c --- /dev/null +++ b/src/links.11ty.liquid @@ -0,0 +1,21 @@ +--- +permalink: '/links.json' +--- +{% assign links = articles | reverse %} +{ +"version": "https://jsonfeed.org/version/1", +"title": "Links • Cory Dransfeldt", +"icon": "https://coryd.dev/static/images/avatar.webp", +"home_page_url": "https://coryd.dev", +"feed_url": "https://coryd.dev/links.json", +"items": [{% for link in links %} + { + "id": "{{ link.href }}", + "title": "{{ link.description | escape }}", + "url": "{{ link.href }}", + "content_text": "", + "date_published": "{{ link.time | date: "%Y-%m-%dT%H:%M:%S-08:00" }}" + }{% if not forloop.last %},{% endif %} +{% endfor %} +] +}