This repository has been archived on 2025-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
coryd.dev-eleventy/src/_data/follow.js
2023-08-24 13:22:45 -07:00

23 lines
847 B
JavaScript

module.exports = async function () {
const { ActivityFeed } = await import('@11ty/eleventy-activity-feed')
const feed = new ActivityFeed()
feed.addSource('atom', '📝', 'https://coryd.dev/feed.xml')
feed.addSource('atom', '🔗', 'https://coryd.dev/links.xml')
feed.addSource('rss', '🎥', 'https://letterboxd.com/cdme/rss')
feed.addSource('atom', '📖', 'https://coryd.dev/books.xml')
const entries = feed.getEntries().catch()
const res = await entries
const activity = { posts: [] }
res.forEach((entry) =>
activity.posts.push({
id: entry.url,
title: entry.title,
url: entry.url.includes('coryd.dev')
? `${entry.url}?utm_campaign=syndication&utm_source=follow`
: entry.url,
content_html: entry.content || '',
date_published: entry.published,
})
)
return activity
}