diff --git a/src/links.html b/src/links.html index 01c09ece..3229db54 100644 --- a/src/links.html +++ b/src/links.html @@ -13,9 +13,9 @@ pagination: -
{{ link.summary | markdown }}+
{{ link.summary }}{%- if link.note %} -
{{ link.note | markdown }}
+{{ link.note }}
{% endif -%} {% endfor %} diff --git a/src/posts/2024/link-blogging-using-readwise.md b/src/posts/2024/link-blogging-using-readwise.md new file mode 100644 index 00000000..396341b2 --- /dev/null +++ b/src/posts/2024/link-blogging-using-readwise.md @@ -0,0 +1,72 @@ +--- +date: '2024-01-10' +title: 'Link blogging using Readwise Reader' +description: 'How I use Readwise Reader to post and share links.' +draft: false +tags: + - 'development' + - 'tech' + - 'Eleventy' +--- +I use Readwise Reader's API to populate the links on [my now page](/now). These then get included in [my follow feed](https://feedpress.me/coryd-follow) that's syndicated out to Mastodon using a [GitHub action](https://github.com/nhoizey/github-action-feed-to-mastodon) authored by [Nicolas Hoizey](https://nicolas-hoizey.com). + +The `data` file used to fetch these links looks like this: + +```javascript +import EleventyFetch from '@11ty/eleventy-fetch' + +export default async function () { + const API_TOKEN_READWISE = process.env.API_TOKEN_READWISE + const url = 'https://readwise.io/api/v3/list?location=archive' + const res = EleventyFetch(url, { + duration: '1h', + type: 'json', + fetchOptions: { + headers: { + Authorization: `Token ${API_TOKEN_READWISE}`, + }, + }, + }).catch() + const data = await res + const links = data['results'].map((link) => { + return { + title: link['title'], + url: link['source_url'], + tags: [...new Set(Object.keys(link['tags']))], + date: link['created_at'], + summary: link['summary'], + note: link['notes'], + description: `${link['summary']}` and, if I've added notes to the document (which I'll now aim to do more consistently), it will render them below the ``. Now, *all* of the links I've shared are at least visible *somewhere* on my site instead of the five most recent on [my now page](/now). + +There you have it — link blogging via Readwise Reader[^1]. + +[^1]: Or lazy link blogging, if you'd prefer. \ No newline at end of file