diff --git a/.env b/.env index c1fa2a1a..f2067092 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ API_KEY_LASTFM= API_KEY_TRAKT= -API_KEY_WEBMENTIONS_CORYD_DEV= \ No newline at end of file +API_KEY_WEBMENTIONS_CORYD_DEV= +ACCESS_TOKEN_MATTER= \ No newline at end of file diff --git a/src/_data/articles.js b/src/_data/articles.js new file mode 100644 index 00000000..102fbd6b --- /dev/null +++ b/src/_data/articles.js @@ -0,0 +1,15 @@ +const EleventyFetch = require('@11ty/eleventy-fetch') + +module.exports = async function () { + const MATTER_TOKEN = process.env.ACCESS_TOKEN_MATTER + const headers = { Authorization: `Bearer ${MATTER_TOKEN}` } + const url = `https://web.getmatter.com/api/library_items/favorites_feed` + const res = EleventyFetch(url, { + duration: '1h', + type: 'json', + fetchOptions: { headers }, + }) + const feed = await res + const articles = feed.feed.splice(0, 5) + return articles +} diff --git a/src/_data/movies.js b/src/_data/movies.js index 03a81548..a620e532 100644 --- a/src/_data/movies.js +++ b/src/_data/movies.js @@ -9,7 +9,9 @@ module.exports = async function () { getExtraEntryFields: (feedEntry) => { const images = feedEntry['description']?.match(/]*src="[^"]*"[^>]*>/gm) || [] return { - image: images.length ? images.map((image) => image.replace(/.*src="([^"]*)".*/, '$1'))[0] : '', + image: images.length + ? images.map((image) => image.replace(/.*src="([^"]*)".*/, '$1'))[0] + : '', } }, }).catch((error) => { diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid index 9f60a7fe..97376418 100644 --- a/src/_includes/now.liquid +++ b/src/_includes/now.liquid @@ -101,7 +101,7 @@ layout: main {% endif %} {% if books %}

- Reading + Reading: books

{% endif %} + {% if articles %} +

+ Reading: favorite articles +

+
+ +
+ {% endif %} {% if movies %}

Watching: movies