I originally posted this post on my blog.
Two weeks ago, one of my posts went viral.
This one:

This Is Why We Don't Test Private Methods
Cesar Aguirre ・ Feb 3
When I say "viral," I mean viral by my standards. It received +30 reactions, +30 comments, and +5K views. That was after two days of posting. Two days! It probably got syndicated or reshared somewhere else.
It's not that impressive for tech influencers with a larger follower count. But it is for me.
Since I don't want this to be a "see how cool I am" kind of post, here are 5 lessons I learned that I'd like to pass on to new bloggers and writers:
1. You can't predict your next hit
No matter how hard you try, you can't predict which post will go viral.
Often the posts you write to mark the calendar are the ones that get some traction, not the ones you spend time crafting. This one was one of those posts. I wrote it to mark the calendar.
Since you can't predict your hits, keep writing, even if you think nobody is reading.
2. Go with social blogs to get more traction
I wrote that post originally on my blog in November 2024. Since then, it only got less than 10 views.
But it went viral when I updated and reposted it here on dev.to. It was sitting on my blog behind search engines. I had to wait for search engine bots to crawl, index, and rank my post. And that could take weeks or months.
On social blogs, like dev.to, there's already an audience and a discoverability feature. Old-fashioned blogs don't have that. That's the problem with blogs.
If you're new to blogging or struggling to keep writing, don't start on your own blog. Go with a social blog.
3. Always promote something at the end of your posts
These days, I have learned from Spain's top copywriter, Isra Bravo, that an email should be like a radio show.
A radio show has a bit of education, a bit of entertainment, and a promotion. And a post should be the same.
Promote something at the end of your posts: your ebooks, newsletter, or courses. I got +20 downloads of my ebook Unit Testing 101: From Zero to Your First Tests on my Gumroad page thanks to that post.
Promote something that aligns with the content of your posts. Don't just simply ask for a coffee.
If you don't have an ebook or something, promote other posts. Netflix does the same at the end of a movie or show.
4. Remember the 30/30/30 rule
My post got more than 40 comments.
Some people jumped to support my idea. Others jumped to offer interesting alternatives. Others simply said I wasn't answering anything. Others went on a tangent talking about something completely different. Somebody else jumped to promote an non-coding business. Whaaaat!
No matter who you are or what you do, 30% will love it, 30% will hate it, and 30% won't even care.
5. Answer questions in public
I didn't come up with the subject of that post myself. I stole it.
One day I was wasting my time on Reddit, probably waiting on a line or something, and I found that question. I realized I could answer it and I did so.
It was a genuine question someone asked. Someone else will probably google the same question. And answering it was good in SEO terms for my blog.
Don't be afraid of stealing post subject ideas. Just the subject ideas, not the content. That's bad.
Join my email list and get a 2-minute email with curated resources about programming and software engineering every Friday. Don't miss out next Friday email.
Top comments (1)
Viral posts teach key lessons: write compelling headlines, engage readers emotionally, keep content concise, optimize for SEO, and promote strategically. Just like a well-structured Union City Lahore Payment Plan for flexible and affordable investment options in a prime location, a successful blog must be clear, valuable, and well-promoted to attract attention and sustain interest.