How I publish articles to all developer platforms (and my private blog) in one shot
Where to host your blog?
The answer > everywhere!
To reach the highest number of people, I decided to publish it everywhere with automated content distribution tools. Unluckily, I couldn't find any tool that would meet my needs:
- allowing me to write just once
- have it published automagically everywhere
In this post, I'll show you how I achieved what I wanted - I hope you'll find it helpful on your own blogging adventure.
My blog uses markdown to build the HTML for the articles. Markdown is quite good for it as it's very portable. All, Hashnode, Dev.to, and Medium support markdown in their APIs. This is perfect - it allows me to write a single markdown file and have it published everywhere.
After the markdown file (the article) is written down, we need to use APIs. So, the tool needs to take the markdown and deliver it in the correct format to APIs of all the different platforms we target.
The first version of the tool is a simple CLI app. It's relatively fast to create and validates the concept quickly - we don't need backends, UIs or any other crazy stuff from the very beginning. BTW, I named the app Rollout to refer to it in this post more easily, hah!
I won't go over the details of how the CLI is implemented (as it's not the topic of this post, it's very simple, though - you can see the code here). I'll jump straight into showing how to use the tool and how simple it is to have your posts published everywhere.
1. Install the tool
brew tap pjeziorowski/rollout-cli brew install rollout-cli
If you are on Linux/Windows, for now you need to build the app from the source. I'll improve it soon!
2. Write the article - this is definitely the most challenging part! Luckily for you, I wrote one that you can use for the test!
echo "--- title: Test Rollout CLI canonical_url: https://google.com/test tags: [Blogging, Automation] --- ## Hello Rollout! " > ./test.md
3. Distribute the article
P.S. you also need to provide API tokens for the tool to use, it'll show you a hint you when you give it a try.
Congrats! Your post is now published everywhere
Hey... Did you forget somethin? You only published to Dev.to, Hashnode and Medium. What about your (and mine!) private blog?
Well, in my workflow, I publish posts to my blog by simply pushing markdown to my Github repository, so the tool doesn't have to do anything more. It's enough for me now, but in the future, Rollout could also be integrated with any headless CMS, for example. If I had a WordPress blog, I would simply use the WordPress API to push the article there. Luckily for me, all I have to do is store my posts on Github. If it's the same for you, welcome to the happy bloggers club!
As I mentioned earlier, you can see the tool's code in its Github repository. If you like the idea or the tool works for you - please give it a star and leave a feedback comment (if they are yet implemented on this site, ha) or contact me on Twitter/Linkedin directly.
If I see interest in the tool, I'll put more work to make it more versatile and probably create a UI (SPA) and some backend for managing the content and configuration. Contributions and suggestions are also very welcome!