DEV Community

Discussion on: Against Namespacing Personal Sites

ohryan profile image

By the other hand, adding year, month, day into the URL means you don't understand the basics.

I strongly disagree.

so what's the point on adding a folder called 2020, another one called september and another one called 10 just for storing here what?

The 2020 "folder" will show you all posts from 2020. The 2020/10/ path shows you all posts from October 2020 and 2020/10/11 retrieves all posts from 11th October 2020. It's greate way to get an overview of posts from a specific time in the history of a blog.

joelbonetr profile image
JoelBonetR • Edited on

I may not explained well the concept.
I mean that you don't have a directory called 2020, you will have N DB Rows of posts where their date_add or publish date is a datetime type field.

That makes you able to show all posts from 2020 by simply querying

SELECT * FROM posts WHERE date_add >= '2020-01-01' ; 

Same for specific month, day, hour, minute...

There's no data stored into physical or logic folders, all data is usually set inside the database instead, so why do you want to add and map an inexistent server directory?

You can also think into media which is stored on the server, well that's another story, you'll also store into the DB the URL of that resource and of course, the date_add so same here. Moreover if you want to distribute your blog you'll need to store your media into something more "open" such a CDN like storage service (look at Google Cloud Storage for example) so that will not be an issue as you only will need to update your DB rows with this new URLs and that's all. If you rely on server directories it will be a massive mess to distribute.

Thread Thread
ohryan profile image

There's no data stored into physical or logic folders, all data is usually set inside the database instead, so why do you want to add and map an inexistent server directory?

Well it's not a server directory, it's a rewrite rule that generates a DB query.

The original purpose of this style of URL structures is to have a human navigable path (which has the side effect of also helping search engines, especially 15-20 years ago).

By "human navigable" I mean that a human can easily decompose the URI back to the site root and get meaningful content along the way.

  1. /2020/09/12/some-blog-post is a blog post posted today
  2. /2020/09/12/ remove the post slug and now you've got all posts from today
  3. /2020/09/ remove the day and now you've got all posts from this month
  4. /2020/ remove the month and now you've got all posts from the year.
  5. / remove the year and now you've got all posts on the blog.

Without this structure a human would have to perform a search typically with an ugly URL with a bunch of query params that are difficult for a human to type easily. Sure you could dynamically generate a link to archives that fills in the params but you don't really want to pollute your pages with links for every year, month and day you've posted content.

This URL structure is an artifact from the early days of blogging when we had much debate exactly like this.

Thread Thread
joelbonetr profile image

Yup, of course I know and understand the origin. Moreover there was some blogging tools that generates physical/logical server directories with text files to store the data.

Nowadays you don't need those params, and the average user hardly will be editing the URL so you build usable UIs with nice options to search and filter through your data to provide content to your users/customers. That implies providing links that shows correctly and on a non-verbose way what it's all about. Specially because most of time the URL string is shown break so you can not read it all.

Moreover if you provide a good search in between your data (title, content, category, tags, media alts and so) it will be much more fast than giving options to filter only (by year, category and tags).

Also for RSS sharing getting a link like:

Will be preferred in comparison to: