Why and how I switched from Medium
I have been writing on Medium for more than 5 years on various technology topics.
I have finally decided to switch from Medium to a self hosted setup. Though the self hosted setup is not what I was looking for, I did end up hosting everything on a small Digitalocean droplet costing me less than $5 per month, which I also use for multiple other things.
Some reasons for moving away from Medium#
Writing in the terminal#
As a developer, I spend a lot of time in the terminal and the IDE and I want to be able to write directly from it. Switching back and forth while I am experimenting with something while writing any post is not very seamless. I am fast in the terminal with a lot of keystrokes in my muscle memory. I believe writing should be as easy as your thoughts. Removing any restriction or hindrance in writing is something that I am going to optimize for, given the amount of effort it does require to write a well crafted post. As you read this, I am comfortably in my terminal, with my own theme, with everything of my own choice.
Support for markdown#
Medium doesn’t have native support for markdown. There are multiple libraries or github actions which allow you to translate markdown to medium supported format. However, given the pace at which things change or become outdated, I don’t want to depend on any other plugin.
Version control#
All my blogs are in version control allowing me to revisit or structure them in whatever format I want. This allows me to switch to any other platform or format effortlessly, given the vast compatibility with the format. I can also effortless change multiple blogs or things at once and have automation on top of version control.
Custom features like series, searches and more#
Over the years, I have felt a need to have specific criteria for certain kind of posts which require a Series kind of a structure. In certain cases, I have wanted to search something across all my blogs instead of iterating one blog at a time. All this becomes very easy with owning the pipeline.
There are many more smaller requirements which will come to light as the pipeline becomes more mature.
What did I move my blog to?#
I was hoping to find a static site generator from markdown files with a very light weight theme. I came across Hugo and it seemed to fit the bill perfectly.
You can select your own themes and modify them using Hugo.
Hugo is not the end goal, I have other modifications that I want to make to the site. Hugo is a good starting point for my requirements at the time. I am getting comfortable with the layout and am planning to make changes to the actual framework for my use cases.
For example, one thing I noticed was the Hugo’s recommended searches are client based and not server based. The fact that it’s a static site does have some restrictions. I am planning to figure out a way to support it properly on the server.
Steps to migrate from Medium#
- You can download your content from Medium which exports all the content in HTML and other static assets like images
- I used medium2hugo to convert the HTML files into markdown. I did encounter some issues here which is listed below.
- Setup Hugo and decide which theme you would want to use. I went with the terminal-theme.
- Copy the generated markdown content to the
content/posts
folder inside the Hugo folder. - Configure the Hugo site accordingly and run the
hugo
command which generates a static site in thepublic
folder. - Configure nginx to route the requests as per your requirement.
Few issues with medium2hugo#
This section lists the issues encountered with the medium2hugo
converter.
- Images were not rendered, it doesn’t account for the right location for images.
- All headers were converted to h3, which may have been a medium issue as well, but the converter should have accounted for it, given that it’s specific to Medium.
- URLs automatically added the username as displayed in Medium, which is not something people would generally want from their personally hosted blog where the URL itself is an identifier.
- Conversion of github gists and other blobs are not properly done. It shows up in a weird syntax or no styling at all in the generated markdown page.
I understand these bugs may have been specific to my use case or I may have skimped through additional configuration which provides the above features. Nevertheless, I was hesitant to spend more time on this step.
Other parts of the blog#
The website is self hosted on Digitalocean, and everything is backed by Terraform with Nginx for TLS termination. The CI/CD is currently taken care of by Github Actions.
I have setup analytics for user behaviour using Google analytics and planning to integrate with a mailer service as well.
This means that if my site ever goes down, I can switch to a new machine and have the site up and running in a matter of seconds.
I want to introduce a few other sanity and liveness checks on the blog as well, but haven’t yet decided on the right checkmarks.
Hopefully, you find the new blog faster to load and helpful in your journey.
Visit gauravsarma.com and enjoy more tidbits in the future.
Conclusion#
I already feel the decision is worth it as I write this first blog from the terminal. I am finally using my domain name I purchased and parked for more than 6 years.
Hope you liked reading the article.
Please reach out to me here for more ideas or improvements.