Breaking Changes: URI Fragments

Published

It’s been a few years since I’ve (intentionally) introduced any breaking changes to this website that you, as a reader, should have noticed.

Oh wow lookie, a convenient header!

Here’s the latest one:

In my opinion, there’s two main ways of structuring fragment links to headers:

  1. A slugified” version of the text content (the most common and the route I went with) which prioritizes human readability e.g. /uses#coffee goes to the coffee” section of the uses” page.
  2. Based entirely on the hierarchy and order i.e. “this is the nth header” which prioritizes being tightly coupled to the underlying markup structure.

I’m more into clean” and pretty” humane URLs so I opted for the first route. I think if it was kosher to let HTML IDs start with a digit, I’d be more interested in the 2nd option. I do like the option of doing something like href="#3.1" which would be targeting the first header that is a child of the third header” or something like that.

Ultimately, I don’t use many headings in my writing so this doesn’t come up as often as I’m probably thinking it does. To be honest, this mostly came as a side effect of building out my /uses where I wanted to have an abnormal amount of headers to act as the demarcation (I’ve wanted a good excuse to use that after it entered my vocabulary in the past year) between content.

A neat aside, I learned that you can customize the autogenerated header ID in Markdown like so:

## My Heading {#custom-id}

And renders, as expected:

My Heading

Which is a great tip since cool URIs don’t change even though I’m (unfortunately) changing mine all in the name of selfishness a Better Future™ as I said last time.

One last thought: since the fragment part of a URI isn’t sent to the server, you don’t get a 404 log in the same way. I wonder if there’s been any effort to try and accomplish the same thing client-side and report it. I’ll try and remember to write that down for later. :)


I love hearing from readers so please feel free to reach out.

Reply via emailSubscribe via RSS or email

Last modified  #announcement   #meta   #ux   #blot 


← Newer post  •  Older post →