Files
website/content/blog/re-strong_opinions_on_url_design.html
2025-11-19 06:59:37 -08:00

32 lines
3.2 KiB
HTML

<article>
<header id="title-block-header">
<h1 class="title">Re: Strong Opinions On URL Design</h1>
<p class="date">2025-03-11T00:00:00-08:00</p>
</header>
<p>Vale wrote <a href="https://vale.rocks/posts/strong-opinions-on-url-design">an opinionated blog post</a> on the following list of things to consider when designing a URL.</p>
<ol>
<li>Keep It Simple</li>
<li>No Capitals</li>
<li>No IDs</li>
<li>No Spaces</li>
<li>Hypens, Not Underscores</li>
<li>Don't Overuse Periods</li>
<li>No www</li>
<li>No .html</li>
<li>Trailing Slash On An End</li>
<li>Useless Paths</li>
<li>Date Paths</li>
</ol>
<p>I do agree with some of these, but I also ultimately feel that people can and should do whatever they want with their website. Doing so adds a personal touch to each website, they don't all need to be the same. Vale's guidelines are great suggestions for creating URLs that are easily understood and shareable. But I do disagree with some of the guidelines and I wanted to share why I disagree.</p>
<h2>Hyphens, Not Underscores</h2>
<p>Underscores do require an extra and awkward keypress to type, but they are a useful symbol. I use hyphens AND underscores in my file and directory names, because they each represent a different function in a joined string of characters. Underscores join strings of characters into a single string, and hyphens separate strings from each other. This is useful if you are selecting text with a mouse and only want to select a specific string, or to visually separate different concepts in a file name, such as the date and title of a file.</p>
<p>For example, all of my mix files include the name of the collection, the date, and occasionally the time it was recorded. If I want to copy the text of the name, I can double click to select that underscored string. I would have to click and drag if the words were hyphenated. Of course clicking and dragging the cursor isn't a big deal, but a double click is more efficient than clicking and dragging. Use the following text to try selecting strings of underscored and hyphenated text:</p>
<p>Underscored: <code>date_string-title_string-other_string</code></p>
<p>Hyphenated: <code>date-string-title-string-other-string</code></p>
<p>So I am advocating the use of underscores and hyphens, not either/or, because they each have a specific function for how a mouse interacts with a string of text.</p>
<h2>No .html</h2>
<p>I think it is appropriate to leave the <code>.html</code> at the end of a URL, in certain cases. If somebody is downloading a final product of sorts, like a blog post, then the URL should indicate it. Creating URL paths is completely arbitrary, but if the file being opened is an index.html, then it should be the index for the pages in that directory. And if the file being opened is the final destination, then the URL should reflect that with the file extension.</p>
<h2>Trailing Slash On An End</h2>
<p>I absolutely agree with Vale on the trailing slash on the end, it just needs to be pointed out that if we include the <code>.html</code> in the filename, then there would be no confusion with what a trailing slash indicates. Trailing slashes obfuscate the index.</p>
</article>