It starts with a title

Dear reader, today I want to tell you a story that happened not too long ago. Actually, it all happened this morning. Get prepared to go through a journey within the depth of simple actions and unforeseen consequences. Are you ready?

It all started as I was taking a look at the feed [1]. I noticed rosie from the Midnight wrote her first post [2] and naturally I opened it (hello rosie by the way, if you are reading this!). I saw that the title on her post was duplicated.

[1] feed
[2] rosie's first post

Upon inspection, I realized the title was duplicated was because rosie wrote it within the "Content" section of the post form, using the gemtext header syntax (#). Which is completely fair! It's regular gemtext. Why should writing a post require a special "title" field? After all, gemtext has it within its own syntax already. Why not have Smol Pub automatically extract any title from the content of the post, and use it as a title in the feed? That would simplify the UI. I like when things are simpler. So hey, why not give it a try?

And so I did. Writing a post only had two fields: slug and content. In the content, you would write your post. The UI was much simpler. Creating a new post or a new page had essentially the exact same UI, since none had a required title field anymore.

However, at that point, I hit the first roadblock. If I write a post without title, the system would tell me that a title is required. It's a little confusing since there's no title input anymore. One needs to understand that they need to start the content with "# this is my title". So I thought, "let's make the title optional".

And again, I did. And it works. But now when I check my journal, the links don't have names any more. I guess that makes sense, since there are no titles anymore. I just need to find something to use when there's no title. I started by adding the time the post was written. That way, anyone could write an entry without a title, and it would be listed with the time it was published, just like in a journal. At this time I was confident I did the right thing and pushed the update live.

... only to realize that the time was the time of the server. Meaning that anyone writing posts without a title would get a time that can be vastly different than what it should be, unless they live on the same timezone of the server. That's a little annoying, but there's still a way. I could have a timezone option for each user. They would just select it and their posts would use the correct timestamp. At that point I saw that I was adding complexity on top of complexity, and I realized I was probably not doing the right thing.

I decided to change the default title from current time to "Untitled post". It's not perfect, but at least it solves the timezone issue. But now comes another problem: what if the feed gets filled with "Untitled post"? That would probably not be the best reading experience. If it's not something I want to promote, why allow it in the first place?

I tried another strategy: If someone types a title with #, great, we use that one, otherwise, let's use the first 20 characters of the post. It's simple to add, and removes the "Untitled post"(s) from the feed. For a minute, I thought I found the perfect solution.

But then I realized that now, instead of having a single way to write a title, I had two: either through using #, or without. And since it's simpler not to type #, there's a good chance people prefer that option. But that option is definitely not the best when we want to use a title: it doesn't rely on the title semantics, so doesn't become an <h1> on the web, which isn't ideal for accessibility.

At that point I was ready to roll back. I did learn a few things: too much simplification sometimes hides complexity somewhere else. Constraints can be a good thing, especially when they enforce best practices. Explicit is sometimes better than smart.

And to finish, here's the picture of the negroni I had yesterday.


Written with Smol Pub
From Dusk's End, Nightfall City