picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.85k stars 615 forks source link

Add hidden identifier in blog posts file naming #365

Closed kalvn closed 8 years ago

kalvn commented 8 years ago

In order to avoid my blog folder to become a mess, I would love to have a way to prefix files by something that would then be automatically removed when generating the URL.

For example, we could remove everything that comes before the first point character (.), like Grav does. Therefore, I would name my files:

201607071450.my-awesome-post.md
201607071138.my-incredible-post.md
201607061222.my-super-post.md
201607051921.my-great-post.md

respectively for articles written on 5th of July at 19:21, 6th of July at 12:22, 7th of July at 11:38 and at 14:50. That would even enable to sort alphabetically within Pico and still have the correct order.

Or for people who prefer this, we could prefix them with an ID for example.

04.my-awesome-post.md
03.my-incredible-post.md
02.my-super-post.md
01.my-great-post.md

What do you think?

PhrozenByte commented 8 years ago

I originally wanted to say something like

Wow, what a coincident. I was searching for a meaningful, short example of a plugin for our about page (#352) - and this is just the perfect example! :+1: :smiley:

However, some time after I've started writing the example, I realized that this is going to be much more complex than I thought in the first place. This definitely is nothing for Pico's core (most users don't expect something like this to happen), but it can be realized with a plugin (like... yeah... anything). I could say that I'll keep this in mind for Pico's official blog plugins we're planning to release together with Pico 1.1 (#334), however, I didn't want to stop after I've started to work on the example code, thus you can now use some sort of "commissional work" "for free".

To cut a long story short: https://github.com/PhrozenByte/pico-file-prefixes

Have fun! :laughing: :smiley:

kalvn commented 8 years ago

You rock, thanks :)

And by the way thanks for this great CMS which perfectly matches what I was looking for. Keep going :)