TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: URL format for blog posts - which format is best?

6 pointsby design-of-homesover 2 years ago
<i>Example 1</i>:<p>myblog.com&#x2F;my-readable-but-long-blog-post-title-in the-url<p>OR<p>myblog.com&#x2F;posts&#x2F;my-readable-but-long-blog-post-title-in the-url<p><i>Example 2</i>:<p>myblog.com&#x2F;2022&#x2F;08&#x2F;my-readable-but-long-blog-post-title-in the-url<p><i>Example 3</i>:<p>myblog.com&#x2F;62642060<p>---<p><i>Pro and cons</i>:<p>Examples 1 and 2: Readable but long URLs. They may also help SEO (search engine optimisation).<p>Example 2: The date in the URL provide helpful context.<p>Example 3: A short URL easily shared (but URL is not descriptive).<p>Which of these URL formats do you prefer? Or do you think they don&#x27;t really matter?<p>Thank you :-)

8 comments

encryptluks2over 2 years ago
I think example one is the best. First, having date in URL sounds great but it is really just metadata. It is also relative to where you live. You might want to add multilingual features at some point. Or if you need to pull down a post and republish it at a later date now you might be stuck with multiple aliases. Having a descriptive title in the URL usually provides enough insight for someone just seeing the link to know what is is about. Sometimes bookmark managers mess up and lose titles. If you see the URL it is helpful to know what the content represents. Tools like Hugo will do this for you automatically as well.
chucksmashover 2 years ago
Example 1 with the `posts&#x2F;` prefix for canonical url.<p>Even with that canonical url, you can still provide your own url shortening service a la example 3. Given the choice, I&#x27;d slightly prefer using a first party shortener that maps a single shortened link per piece of content versus third party one creating a shortened link per share.<p>year&#x2F;month prefix is useful to readers if the content becomes stale quickly.
mayoiover 2 years ago
It doesn&#x27;t really matter to me that much because it&#x27;s all useless and too long to remember that I will bookmark everything I care about and give them a proper name handwritten title by myself, but if I had to choose, it would instead look something like the urls in software documentation:<p>&gt; <a href="https:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;cpp&#x2F;container&#x2F;vector" rel="nofollow">https:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;cpp&#x2F;container&#x2F;vector</a><p>See? You don&#x27;t even need to open it to know what&#x27;s going to be there.<p>Sadly, it&#x27;s kind of hard to map for arbitrary blog topics so I can&#x27;t give you a realistic example for how it would work there, but I guess if you made a post about new foreign recipe, it could probably be<p>&gt; &#x2F;&lt;country of interest&gt;&#x2F;&lt;topic of interest&gt;&#x2F;&lt;object of interest&gt;<p>&gt; &#x2F;japan&#x2F;food&#x2F;salmon<p>Your imagination is your only limit and I recommend you stop to think about what is the purpose of spending that much time on it, and you may find what you need.
mindworkover 2 years ago
My thinking would be this:<p>* If you have a subdomain for your blog(example: blog.mydomain.com) then you don&#x27;t need &#x2F;posts<p>* if you don&#x27;t have subdomain, you can use &#x2F;posts, to distinguish between regular pages of your site and blog articles. Because you might have mydomain.com&#x2F;about and mydomain.com&#x2F;contact pages<p>* Don&#x27;t put metadata such as publish dates as it can be modified or changed in the future. Also it&#x27;s relative.<p>* As for example 3, you would probably need it in case when you have <i>lots</i> of articles and there might be a slug collision. I wouldn&#x27;t worry about that unless you are media organization
Jaruzelover 2 years ago
Things like &#x2F;article or &#x2F;blog or &#x2F;posts signal to Google the type of content.<p>Having a date in the URL also signals how fresh the content is.<p>Google also state that descriptive URLs get higher click throughs via search than non descriptive.<p>Personally I&#x27;d go with example 1, option 2.<p>What I would ALSO do however, is add JSON-LD structured markup data to each post page, as I know Google uses it to classify and date your content.
theandrewbaileyover 2 years ago
Not sure if this is the best, but here&#x27;s what I do.<p>&#x2F;article&#x2F;<i>postNumber</i>&#x2F;<i>Article-Title</i><p>e.g.:<p><a href="https:&#x2F;&#x2F;theandrewbailey.com&#x2F;article&#x2F;266&#x2F;Cinco-de-Mayo-Burgers" rel="nofollow">https:&#x2F;&#x2F;theandrewbailey.com&#x2F;article&#x2F;266&#x2F;Cinco-de-Mayo-Burger...</a><p>I&#x27;ve always been succinct in my titles, so getting overly long URLs isn&#x27;t much of an issue, except on HN comments.
eimrineover 2 years ago
If talking about proposed ones I like first approach. But I have seen even better approach when readable-title-in-url is short and custom. For example, article with header &quot;My Readable But Long Blog Post&quot; may be just myblog.com&#x2F;readable
soueulsover 2 years ago
I tend to avoid time related information on my website. I try my best to write evergreen content, showing the date almost always brings negative consequences such as people bouncing off your website before reading.