openknowledgebe / website

Open Knowledge Belgium website
https://openknowledge.be
MIT License
4 stars 0 forks source link

CMS: Story slug and url #17

Closed jbelien closed 3 years ago

jbelien commented 3 years ago

At the moment, the slug for a story is launch-of-civic-lab-brussels-20201201174631.md and the url is /stories/launch-of-civic-lab-brussels-20201201174631.

The datetime in both slug and url is the datetime when the story is created. It should be only the date of the story itself (and not the moment the story is created).

The slug format should be 20170505-launch-of-civic-lab-brussels.md and the url should be /stories/2017/05/05/launch-of-civic-lab-brussels/ (so we keep the same format as the current posts).

auloin commented 3 years ago

Good point. I think this will also help to avoid breaking links. Should I drop the /stories which is not part of the current format? Also the datetime (in the new version) is there to avoid collisions between post titles so I can drop it at build time.

jbelien commented 3 years ago

Should I drop the /stories which is not part of the current format?

Good point, so the current links to the blog posts will stay the same and won't be broken. 👌

Also the datetime (in the new version) is there to avoid collisions between post titles so I can drop it at build time.

I didn't understand that part. 🤔

auloin commented 3 years ago

Also the datetime (in the new version) is there to avoid collisions between post titles so I can drop it at build time.

I didn't understand that part. 🤔

The 20201201174631 of launch-of-civic-lab-brussels-20201201174631 is just there for cases where two stories have the same title (launch-of-civic-lab-brussels). You can see it as an id for the story. It appears in the filename which I'm currently using as the slug as is. But slugs are actually generated at build time, so the last digits do not have to be included in the slug.

jbelien commented 3 years ago

Oh okay, got it.

I still would prefer to have 20170505-launch-of-civic-lab-brussels.md as slug (post date instead of file creation date at the beginning). That suits your "id" purpose (no chance, there are 2 stories with the same name on the same day) + it's easier to file the correct file.

EDIT: If it's too complicated to put the story date (instead of the file creation date), no worries ; just put YYYYMMDD-slug instead of slug-YYYYMMDDHHMMSS.

auloin commented 3 years ago

I just found out that Netlifycms doesn't update the filename (a.k.a slug)... See https://github.com/netlify/netlify-cms/issues/1576.

jbelien commented 3 years ago

Okay, let's keep it simple : YYYYMMDD-slug.md where YYYYMMDD is the creation date.

(I'll update the slug for articles already published in #13)