home
NOTE: Under Construction - I'm in the middle of upgrading my site and lots of stuff is kinda broken. Please forgive the mess.

So Long Pretty URLs

December 2023

TL;DR

I've removed title text and switched to IDs for my site URLs to make them easier to maintain.

Uniform Resource Locators

Ideally, URLs would live forever. Turns out, that's hard to manage. Sites die and take their URLs with them. Even more, sites change the software that runs them which results in content moving to different URLs or disappearing all together.

I've changed software for my site several times over the past twenty years. Each time involved moving the URLs. The primary problem with that is it breaks any links that point to them. I put in redirects to handle that. They catch traffic pointed to the old URLs and send it to the new locations.

That works, but I've only do it for the most recent migration. I've done three or four since 2010 which means any links that point to URLs from that time period are now dead.

Aesthetics and Search Engine Optimization

For a few of the moves, changing the URLs helped get traffic to the site. Adding keywords and titles to the URLs worked as a way to get higher page ranks on search engines. As far as anyone can tell, that doesn't matter much these days. Even if it does, I no longer worry about it.

Beyond the search engine optimization, there's also an aesthetic quality to URLs. In an older version of my site, I spent a bunch of time setting things up to get URLs that were nothing by the domain name and the title of the page.

For example, the URL for this page would have been:

alanwsmith.com/so-long-pretty-urls

I still love the look of that. There's nothing there that doesn't need to be.

Everything's A Draft

I'd still be using those URLs except for one thing. They're based off the title of the post and I change those titles all the time.

My site is an extension of my grimoire. It has over nine thousand notes in it and I'm adding more all the time. Most start out as snippets that I ship to the site as very early drafts. The titles change as the pages mature.

Unlike changing software I have the option of leaving the URLs the same and simply letting them get out of sync with the title of the post. But, part of the reason I like the title based URLs is because the aesthetic ties to the title on the page.

So, we're back to redirects.

A Unique ID

One way to do redirects is to point all the old URLs to the new locations. That seems simple enough at first, but there's a complexity. What if you move a URL two times. Or, three. Or, ten.

You have to maintain a list of all the previous URLs and make sure they redirect properly. This can be done and automated, but you'd have to accommodate the full list across software changes as well.

Besides being fragile, doing that work is not where I want to spend my time. So, I used another system: a unique ID at the end of every URL. They end up looking like this:

alanwsmith.com/so-long-pretty-urls--2zqjnh3a

It's the same as before with the addition of a unique ID at the end. The power of this ID comes from the fact that it's the same for the page regardless of title changes. That let's me set them up so that if a request for a URL comes in that's no longer valid I can use it to redirect to the new one. So all of these:

alanwsmith.com/i-removed-pretty-urls--2zqjnh3a

alanwsmith.com/no-more-pretty-urls--2zqjnh3a

alanwsmith.com/goodbye-pretty-urls--2zqjnh3a

would all redirect to this automatically:

alanwsmith.com/so-long-pretty-urls--2zqjnh3a

Just An ID

That covers things, but it still takes work to implement. It also means I have to make sure the content actually gets removed from the proper URL. As before, this can all be done with code, but coding that is not where I want to spend my time.

So, I'm going the next step. I'm removing the title text all together. My URLs now look like this:

alanwsmith.com/en/2zqjnh3a

With that change all the redirect work goes away.

The 20 Year Plan

My site is twenty years old. When I realized that, I started thinking about the next twenty years. A big part of that is thinking about what I want to spend my time working on. Redirects aren't it.

I'd rather spend time working on the content than jumping frameworks or setting up redirects. That lead me to create my own file format ( neopolitan ) and my own static site generator ( neopoligin ).

It also lead me to this decision.

I want my URLs to last, but I don't want to have to futz with them. And now, I don't have to.

═══ § ═══

Note: Human Readability

I didn't explicitly get into the human readability of URLs, but that's where the aesthetic design came from. I'm not sure how much it ever really mattered, but being a techie I really like URLs that you can read and know what they are. But, the amount of work it would take to make that happen simply isn't worth it to me any more.

Note: The Pages

You may have noticed I added a "pages" directory level to the URLs. That's purely to make it easier to see content when I'm working on pages output my grimoire. Everything from the grimoire gets an ID when they are created. Things outside the grimoire get named by hand.

Since I work with a >static site generator>/neopoligin> that uses a directory structure it helps to keep the thousands of grimoire pages separate from the few I edit by hand so that I can find them easily.

═══ § ═══