How to automatically post from Gatsby to Medium and dev.to
Mario
Posted on January 23, 2021
A professor at university once said to me:
If he has to decide on hiring a lazy student or a top-notch student, assuming both get the same work in the same time done. He would always choose the lazy person, because the lazy student is more efficient.
After all these years I'd say don't be lazy, be smart. Automation can help you get the job done quicker and saves you time, which you can spend on the things you love. Maybe more coding? 😂
The three steps plan
I assume you know your way around npm, Gatsby and javascript. This is what we are going to do:
- Setup an RSS feed in Gatsby
- Create a zap RSS to Medium
- Configure RSS income stream in dev.to
1. Setup an RSS feed in Gatsby
For creating an RSS feed in Gatsby, please refer to this post. How to setup an RSS feed in Gatsby
2. Create a zap
Zapier provides workflows to automate the use of web applications together. It is often described as a translator between web APIs. see wikipedia
So headover to zapier.com and create an account. I would recommend setting up Two-Factor-Authentification.
When you have confirmed your email and you've logged in into zapier, you see a red button MAKE A ZAP. Click it!
Our automation should do this. Create a new medium post if a new item is in our RSS feed.
Choose the app RSS by Zapier.
Choose the trigger event.
Click continue and check if it works with clicking on Test & Review.
I have two items in my RSS feed, so I choose one for further testing and click Done editing.
50% done. YAY. Now we have to setup the Do this... part.
Choose the app MEDIUM and choose the action event CREATE STORY and click continue.
Now choose the medium account you want to connect. If your account, doesn't appear you have to connect your medium account to your zapier account. Here are more details on this.
Now, let's customize our story for medium. You should see a form like this:
All fields marked required, need to be filled in.
- For the title , choose the post title.
- Format should be post HTML.
- The content filed should be the Raw_Encoded post content. As the first line I am adding this, which links to the original post published on my blog and says it's a crossposting.
<p>This story was originally published ...</p>
. - subtitle is optional, I use my description field.
- tags field is optional, I use my custom tags field.
IMPORTANT: for SEO purposes the original source of this content needs to be marked with a canonical tag. Otherwise, you have duplicate content and this could result in a search penalty.
- canonical url is optional, but we don't want to create duplicate content, so put the post url in.
- publish status is also optional, but I want it to go live automatically.
Now, click Retest & Review and your post should get send to medium.
Log into medium and verify. And DONE! YAY. 👍
3. Configure RSS income stream in dev.to
dev.to is an amazing developer community, if you haven't joined yet, do it now and check it out.
To add your RSS Feed to dev.to simply go to settings and click publishing from RSS. Then add your rss feed and click update.
IMPORTANT: The synced posts will be in your dashboards as drafts, so you can double check them. If you want fully auto-posting contact the admins and give them the right to set your posts to public. (send an email to yo@dev.to).
Hope you managed to automate your posts. If you have any questions, use the comment function or send me a message on twitter @mariokandut.
Posted on January 23, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024