skull

Robert Tamayo

R
B
code
skull

Time for a Makeover

Last time, I wrote about the need for doing some upkeep on my blog. Well, it's worse than that.

The blog code has had a bug ever since the beginning (about 4 years) that makes it annoying for me to write new posts. I didn't really care about the bug when I first encountered it, since I never wrote too many posts. But ever since I started writing a new post every day, it slowly got more and more annoying. Eventually, it got so annoying that I stopped noticing it altogether. Now, the workaround is just part of the process.

The bug goes like this: when I write a new post and hit "publish", it doesn't write the post author (me) or the publish date to the database. The author part was bad, but since I was the only author, I could easily solve it by adding a default value to the database. The publish date had a weirder effect.

On the frontend, the post would be published, but no one would see it. That's because the publish date was null, and so it was located at the bottom of the page. The only way to fix it was to update the database manually and write the date in. I did this each and every time I published a post. This is the main reason why it would seem like I wasn't writing every day last year.

I thought about doing a manual workaround on the frontend by unpublishing the post and then publishing it again, but the unpublish button wasn't working, either. It turns out that was due to a typo in the code:

define("ACTION_POST_DRAFT_STATUS", "post_draft_status");
define("ACTION_POST_PERMALINK", "post_draft_status");

Every time I tried to unpublish the backend thought I was changing the permalink instead. Once I fixed that typo, the new workaround proved successful. I no longer have to update the database manually after writing a post. Now, I only have to unpublish a post and then publish it again.

When looking at the code to see how I could fix the problem for real, I realized that there was a whole mess going on with the logic for the dashboard and draft status. I'm deciding that I'm not going to try to fix it, and I'm going to consider writing a simpler version of my blogging platform. This version of the blog is actually Bob Blog 2; the first version was even crazier.

I think it's time for Bob Blog 3. It could have some cool BB3 logo and be the first MODERN web app NOT written in React.


Comments:
Leave a Comment
Submit