# Why do permalinks have year, month, day in them?

**URL:** https://talk.jekyllrb.com/t/why-do-permalinks-have-year-month-day-in-them/6044
**Category:** Uncategorized
**Created:** [May 15, 2021, 8:22pm UTC](https://talk.jekyllrb.com/t/why-do-permalinks-have-year-month-day-in-them/6044 "2021-05-15T20:22:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ChaelCodes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/chaelcodes/32/3567_2.png) [@ChaelCodes](https://talk.jekyllrb.com/u/ChaelCodes)
#### Post date: [May 15, 2021, 8:22pm UTC](https://talk.jekyllrb.com/t/why-do-permalinks-have-year-month-day-in-them/6044/1 "2021-05-15T20:22:14Z")

</div>

So, I understand that Jekyll requires year, month, and day in the permalink and on posts to work, but I don’t understand why.

Is it to protect users against duplicate post titles?  
Is it an SEO thing?  
Was it an early attempt at pagination?  
Does Jekyll rely on it to handle ordering?

Why was this a requirement/feature?

(Please no guesses - real answers only.)

---

<div class="post-metadata">

### Author: ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)
#### Post date: [May 15, 2021, 9:10pm UTC](https://talk.jekyllrb.com/t/why-do-permalinks-have-year-month-day-in-them/6044/2 "2021-05-15T21:10:47Z")

</div>

You _can_ override the permalink to just be name.

But…, you are bound to run into duplicate issues eventually if you aren’t careful in a few months or years and _you won’t even notice_ so your site will break silently.

Jekyll protects us against ourselves in two ways:

- by making date **compulsory** in the filename. So hello.md and hello.md can’t exist together as identical filenames, but 2021-01-02-hello.md  
2021-01-03-hello.md do.
- by making urls unique by including **date**. So /hello.html and /hello.html can’t coexist but /2021/01/02/hello.html and /2021/01/03/hello.html do.

If you want to make your permalink result as /2021-01-02-hello.html without folders then you can do that.

But I’d encourage keeping the date in.

* * *

And for neatness you can figure out how to put posts in /posts/ or /blog/ as a subdirectory

/blog/2021-01-02-hello.html

by setting permalink on posts collection instead of the root permalink, so they don’t exist at the root. But you’re still as risk of duplicates.

* * *

Crawlers don’t care about posts being on a certain date URL, just that the posts can be read and even better if they are in sitemap.

---

<div class="post-metadata">

### Author: ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)
#### Post date: [May 15, 2021, 9:19pm UTC](https://talk.jekyllrb.com/t/why-do-permalinks-have-year-month-day-in-them/6044/3 "2021-05-15T21:19:17Z")

</div>

The Permalink docs don’t explain _why_ date is used in the permalink, but it is logical see that you can choose to use date in permalink or not to, and that not using date is dangerous for duplicates while using a date is safe.

* * *

Jekyll doesn’t force you to use a date in permalink but almost all the presets do use date in some way.

ie you can use a preset like

```auto
permalink: pretty

```

To save writing it out in full.

That turns page /abc.html into /abc/ and the same for blog posts.

Or you can have something like /2021/365/… from the day preset or /2021/52/… for week preset

If you want to drop date in URL completely you can do…

```auto
permalink: none

```

Which is equivalent of doing

```auto
permalink: /:categories/:title:output_ext

```

–

My cheatsheet

> **[Permalinks](https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/jekyll/templating/permalinks.html)**
>
> A collection of code snippets and CLI guides for quick and easy reference while coding

Jekyll docs

> **[Permalinks](https://jekyllrb.com/docs/permalinks/#built-in-formats)**
>
> Permalinks are the output path for your pages, posts, or collections. They allow you to structure the directories of your source code different from the directories in your output.

---

<div class="post-metadata">

### Author: ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)
#### Post date: [May 15, 2021, 9:54pm UTC](https://talk.jekyllrb.com/t/why-do-permalinks-have-year-month-day-in-them/6044/4 "2021-05-15T21:54:02Z")

</div>

One other thought.

The need for permalink in date arises from date needed in filename. Here’s why.

* * *

If you didn’t have the file name restriction then you have to keep track of names yourself by adding your own identifier to satisfy your IDE or shell.

```auto
hello.md
hello-1.md

```

Because at the file level, they can’t both be hello.md.

And then you would have got URLs as

```auto
/hello.html
/hello-1.html

```

That is how blog posts _could_ have ended up and still have no risk of duplicates!

I mean that’s how non blog posts work.

But… because we do have Jekyll setting date as required in post names, you _must_ do this

```auto
2021-01-02-hello.md
2021-01-03-hello.md

```

That alone would mean both output as /hello.html and collide as duplicates.

So as a consequence, we must put date in the permalink for posts, for most cases.

To safely get.

```auto
/2021/01/02/hello.html
/2021/01/03/hello.html

```
