import MarkdownIt from 'markdown-it'; import _ from 'lodash'; import rss from '@astrojs/rss'; import sanitizeHtml from 'sanitize-html'; import { getCollection } from 'astro:content'; export async function get() { const emails = await getCollection('daily-email'); const sortedEmails = Object.values(emails) .sort((a, b) => new Date(b.data.pubDate).valueOf() - new Date(a.data.pubDate).valueOf() ); const parser = new MarkdownIt(); const callToAction = () => { return _.sample([ 'Are you still using Drupal 7 and don’t know what’s involved to upgrade to Drupal 10? Book a Drupal 7 upgrade consultation call.', 'Need help or want another pair of eyes on your code? Book a 1-on-1 consulting call or an online pair programming session with a 100% money-back guarantee.', 'If you\'re creating a new Drupal module, try my free Drupal module template.', ]); }; const convertTag = (tag) => { const words = tag.split("-"); const wordCount = words.length; if (wordCount > 1) { return _.upperFirst(_.camelCase(tag)); } return _.lowerCase(tag); } return rss({ title: 'Daily email list', description: 'A daily newsletter on software development, DevOps, community, and open-source.', site: import.meta.env.SITE, items: sortedEmails.slice(0, 1).map((email) => ({ description: `
P.S. ${callToAction()}