neolateral

programming, drawing, photograpy etc.

Getting Substack Newsletter Posts into a Pelican Site

A few weeks ago I started writing a newsletter at substack.com (which is an excellent platform btw, and I'm loving it). My newsletter is called ArtNoob. Now, substack allows you to export of all the posts on a newsletter, which is a very handy way to grab all the posts and host it on another site. And that's exactly what I wanted to do.

This is a static website https://abhishekmishra.in generated using Pelican. So all I wanted to do was to grab the exported posts and convert them into pelican post format, and regenerate my website.

Grab the Substack Newsletter Posts

To grab the posts from your newsletter, go to https://.substack.com/publish/settings and scroll all the way down to the section which says - "Export your data".

The section looks something like this

View post on imgur.com

Once you've requested the data, substack will send you an email when data is available, and then you can go back to the same page and section and download the zip file.

Extract Data Export

Once you've downloaded the data export zip file, extract it somewhere on disk. Note down the folder because you will need it in the next step.

Edit and Run the import script

I've written the script which processes the exported posts and creates pelican articles with the same content, and import frontmatter metadata added.

Here's the script which includes comments to help you change the paths to point to your newsletter posts folder.

If you need any help running the code, let me know by adding a comment to the gist.

Happy blogging! Abhishek