I want to write more. Not just for future reference or awareness but simply to gain clarity through composition. And ideally to get into the rhythm of putting things out into the world. I believe the pressure of communication expectations from a recurring format will provide that push to write more. So how can we actually automate this?
This site is built using Jekyll. There is a Jekyll Feed plugin that generates an RSS feed of Jekyll posts.
This creates a feed.xml file that looks like the following:
I was a little confused at first because mailchimp makes it seem like you can only touch the HTML of your email if you upgrade out of the free version. Luckily that’s not quite the case and you can toggle block-level HTML with the <> button.
Now that we’ve got the writing section updates working, let’s get updates on resources and around the web sections! To do this we’ll have to associate a date with each item by changing the data structure. Then we can use the generated feed.xml as a base to create the other feeds.
I went through and appended Date: Apr 23, 2020 to every resource…
Now to combine them into an email! And wait… Mailchimp has you declare a single RSS feed to use for the entire email… So maybe we can just see what would happen if we combine the RSS feeds into one using RSSUnify? Oh god it’s just a big jumbled mess. If there is a way to filter better I could not find one albeit I didn’t look very far.
So let’s do this another way. Let’s generate an RSS feed with jekyll meant solely for the newsletter.
With the <items> being the sections of Writing, Resources, and Around the Web.
And we can put all the content inside <description>.
Now XML doesn’t support HTML, it needs to be converted. To solve this we can push the HTML code we need to the Jekyll _includes folder and call it with the liquid tag alongside convert to XML. Oh wait that doesn’t work… Well maybe we can utilize liquid variables… Oh wait, you can chain filters but not place Liquid tags within Liquid tags…
After a lot of trial and error of trying to get this to work I realized that the HTML wasn’t changing and I could just input it already XML escaped to begin with…
Okay but now we need to filter for only items added within the last week. Luckily I had solved this problems earlier when trying to kinda automate emails. You can view that here.
It utilizes a Jekyll filter that pulls every post from within a week of the latest website build. To get the timeframe of a week we can set:
Then to get all writings from the last week we can:
Note the XML escaped HTML—this is not ideal for genuine RSS feeds but we’re just using this as a proxy for an HTML email so it works great.
For the Resources section I had to go through some trial and error to get the nestings right and sort them by date. Due to how the data is structured it sorts them by category and then by date:
Because the Around the Web section is built by date I can simply filter it for the first entry, which will return everything added within the current month.
Now because I appended Date: Apr 23, 2020 to every resource the initial email will contain every single resource. I thought it serves as a nice hallmark to the day I finally figured out how to automate updates.