2022-10-07 09:14:10 +01:00
|
|
|
import rss from '@astrojs/rss';
|
|
|
|
|
2022-10-13 08:40:06 +01:00
|
|
|
const emailImportResult = import.meta.glob('../daily-emails/*.md', { eager: true });
|
2022-10-13 00:15:24 +01:00
|
|
|
const emails = Object.values(emailImportResult)
|
|
|
|
.sort((a, b) =>
|
|
|
|
new Date(b.frontmatter.pubDate).valueOf() -
|
|
|
|
new Date(a.frontmatter.pubDate).valueOf()
|
|
|
|
)
|
|
|
|
|
2022-10-07 09:14:10 +01:00
|
|
|
export const get = () => rss({
|
2022-10-13 08:40:06 +01:00
|
|
|
title: 'Daily email list',
|
2022-10-13 00:15:24 +01:00
|
|
|
description: 'A daily newsletter on software development, DevOps, community, and open-source.',
|
|
|
|
site: import.meta.env.SITE,
|
2022-12-07 23:56:53 +00:00
|
|
|
items: emails.slice(0, 1).map((email) => ({
|
2022-12-20 23:51:52 +00:00
|
|
|
description: `<div style="max-width: 550px;">${email.compiledContent()}</div>`,
|
2022-10-13 08:40:06 +01:00
|
|
|
link: `${import.meta.env.SITE}${email.frontmatter.permalink}`,
|
2022-10-13 00:15:24 +01:00
|
|
|
title: email.frontmatter.title,
|
2022-10-13 08:40:06 +01:00
|
|
|
pubDate: email.frontmatter.pubDate,
|
2022-10-13 00:15:24 +01:00
|
|
|
}))
|
|
|
|
});
|